Showing preview only (1,663K chars total). Download the full file or copy to clipboard to get everything.
Repository: Relintai/entity_spell_system
Branch: master
Commit: 3c240ff2b252
Files: 243
Total size: 1.5 MB
Directory structure:
gitextract_12vn9isv/
├── .gitignore
├── LICENSE
├── README.md
├── SCsub
├── config.py
├── data/
│ ├── atlases/
│ │ ├── character_atlas.cpp
│ │ ├── character_atlas.h
│ │ ├── character_atlas_entry.cpp
│ │ └── character_atlas_entry.h
│ ├── auras/
│ │ ├── aura_group.cpp
│ │ └── aura_group.h
│ ├── items/
│ │ ├── craft_recipe.cpp
│ │ ├── craft_recipe.h
│ │ ├── craft_recipe_helper.cpp
│ │ ├── craft_recipe_helper.h
│ │ ├── equipment_data.cpp
│ │ ├── equipment_data.h
│ │ ├── item_instance.cpp
│ │ ├── item_instance.h
│ │ ├── item_template.cpp
│ │ ├── item_template.h
│ │ ├── model_visual.cpp
│ │ ├── model_visual.h
│ │ ├── model_visual_entry.cpp
│ │ └── model_visual_entry.h
│ ├── loot/
│ │ ├── loot_data_base.cpp
│ │ └── loot_data_base.h
│ ├── species/
│ │ ├── entity_species_data.cpp
│ │ ├── entity_species_data.h
│ │ ├── species_instance.cpp
│ │ ├── species_instance.h
│ │ ├── species_model_data.cpp
│ │ └── species_model_data.h
│ └── spells/
│ ├── spell.cpp
│ ├── spell.h
│ ├── spell_cooldown_manipulation_data.cpp
│ ├── spell_cooldown_manipulation_data.h
│ ├── spell_effect_visual.cpp
│ ├── spell_effect_visual.h
│ ├── spell_effect_visual_simple.cpp
│ └── spell_effect_visual_simple.h
├── database/
│ ├── ess_resource_db.cpp
│ ├── ess_resource_db.h
│ ├── ess_resource_db_folders.cpp
│ ├── ess_resource_db_folders.h
│ ├── ess_resource_db_map.cpp
│ ├── ess_resource_db_map.h
│ ├── ess_resource_db_static.cpp
│ └── ess_resource_db_static.h
├── defines.h
├── doc_classes/
│ ├── AIFormation.xml
│ ├── ActionBarButtonEntry.xml
│ ├── ActionBarEntry.xml
│ ├── ActionBarProfile.xml
│ ├── AuraApplyInfo.xml
│ ├── AuraData.xml
│ ├── AuraGroup.xml
│ ├── Bag.xml
│ ├── CharacterAtlas.xml
│ ├── CharacterAtlasEntry.xml
│ ├── CharacterBones.xml
│ ├── CharacterSkeleton2D.xml
│ ├── CharacterSkeleton3D.xml
│ ├── CharacterSpec.xml
│ ├── ClassProfile.xml
│ ├── ComplexLevelStatData.xml
│ ├── CraftRecipe.xml
│ ├── CraftRecipeHelper.xml
│ ├── ESDragAndDrop.xml
│ ├── ESS.xml
│ ├── ESSEntitySpawner.xml
│ ├── ESSMaterialCache.xml
│ ├── ESSMaterialCachePCM.xml
│ ├── ESSResourceDB.xml
│ ├── ESSResourceDBFolders.xml
│ ├── ESSResourceDBMap.xml
│ ├── ESSResourceDBStatic.xml
│ ├── Entity.xml
│ ├── EntityAI.xml
│ ├── EntityClassData.xml
│ ├── EntityCreateInfo.xml
│ ├── EntityData.xml
│ ├── EntityDataContainer.xml
│ ├── EntityEnums.xml
│ ├── EntityResource.xml
│ ├── EntityResourceCostData.xml
│ ├── EntityResourceCostDataHealth.xml
│ ├── EntityResourceCostDataResource.xml
│ ├── EntityResourceHealth.xml
│ ├── EntityResourceSpeed.xml
│ ├── EntitySkill.xml
│ ├── EntitySkillData.xml
│ ├── EntitySpeciesData.xml
│ ├── EquipmentData.xml
│ ├── InputProfile.xml
│ ├── InputProfileModifier.xml
│ ├── InputProfileModifierEntry.xml
│ ├── ItemContainerData.xml
│ ├── ItemContainerDataEntry.xml
│ ├── ItemEnums.xml
│ ├── ItemInstance.xml
│ ├── ItemTemplate.xml
│ ├── LevelStatData.xml
│ ├── LootDataBase.xml
│ ├── ModelVisual.xml
│ ├── ModelVisualEntry.xml
│ ├── PlayerProfile.xml
│ ├── ProfileManager.xml
│ ├── PropDataEntity.xml
│ ├── SimpleLevelStatData.xml
│ ├── SkeletonModelEntry.xml
│ ├── SpeciesInstance.xml
│ ├── SpeciesModelData.xml
│ ├── Spell.xml
│ ├── SpellCastInfo.xml
│ ├── SpellCooldownManipulationData.xml
│ ├── SpellDamageInfo.xml
│ ├── SpellEffectVisual.xml
│ ├── SpellEffectVisualSimple.xml
│ ├── SpellEnums.xml
│ ├── SpellFollowProjectile3D.xml
│ ├── SpellHealInfo.xml
│ ├── StatData.xml
│ ├── VendorItemData.xml
│ └── VendorItemDataEntry.xml
├── drag_and_drop/
│ ├── es_drag_and_drop.cpp
│ └── es_drag_and_drop.h
├── editor/
│ ├── ess_editor_plugin.cpp
│ └── ess_editor_plugin.h
├── entities/
│ ├── ai/
│ │ ├── entity_ai.cpp
│ │ └── entity_ai.h
│ ├── auras/
│ │ ├── aura_data.cpp
│ │ └── aura_data.h
│ ├── data/
│ │ ├── character_spec.cpp
│ │ ├── character_spec.h
│ │ ├── entity_class_data.cpp
│ │ ├── entity_class_data.h
│ │ ├── entity_data.cpp
│ │ ├── entity_data.h
│ │ ├── entity_data_container.cpp
│ │ ├── entity_data_container.h
│ │ ├── item_container_data.cpp
│ │ ├── item_container_data.h
│ │ ├── item_container_data_entry.cpp
│ │ ├── item_container_data_entry.h
│ │ ├── vendor_item_data.cpp
│ │ ├── vendor_item_data.h
│ │ ├── vendor_item_data_entry.cpp
│ │ └── vendor_item_data_entry.h
│ ├── entity.cpp
│ ├── entity.h
│ ├── resources/
│ │ ├── entity_resource.cpp
│ │ ├── entity_resource.h
│ │ ├── entity_resource_cost_data.cpp
│ │ ├── entity_resource_cost_data.h
│ │ ├── entity_resource_cost_data_health.cpp
│ │ ├── entity_resource_cost_data_health.h
│ │ ├── entity_resource_cost_data_resource.cpp
│ │ ├── entity_resource_cost_data_resource.h
│ │ ├── entity_resource_health.cpp
│ │ ├── entity_resource_health.h
│ │ ├── entity_resource_speed.cpp
│ │ └── entity_resource_speed.h
│ ├── skills/
│ │ ├── entity_skill.cpp
│ │ ├── entity_skill.h
│ │ ├── entity_skill_data.cpp
│ │ └── entity_skill_data.h
│ └── stats/
│ ├── complex_level_stat_data.cpp
│ ├── complex_level_stat_data.h
│ ├── level_stat_data.cpp
│ ├── level_stat_data.h
│ ├── simple_level_stat_data.cpp
│ ├── simple_level_stat_data.h
│ ├── stat_data.cpp
│ └── stat_data.h
├── entity_enums.cpp
├── entity_enums.h
├── formations/
│ ├── ai_formation.cpp
│ └── ai_formation.h
├── infos/
│ ├── aura_infos.cpp
│ ├── aura_infos.h
│ ├── spell_cast_info.cpp
│ └── spell_cast_info.h
├── inventory/
│ ├── bag.cpp
│ ├── bag.h
│ ├── grid_bag.cpp
│ ├── grid_bag.h
│ ├── inventory.cpp
│ ├── inventory.h
│ ├── normal_bag.cpp
│ └── normal_bag.h
├── item_enums.cpp
├── item_enums.h
├── material_cache/
│ ├── ess_material_cache.cpp
│ ├── ess_material_cache.h
│ ├── ess_material_cache_pcm.cpp
│ └── ess_material_cache_pcm.h
├── pipelines/
│ ├── spell_damage_info.cpp
│ ├── spell_damage_info.h
│ ├── spell_heal_info.cpp
│ └── spell_heal_info.h
├── profiles/
│ ├── actionbar/
│ │ ├── action_bar_button_entry.cpp
│ │ ├── action_bar_button_entry.h
│ │ ├── action_bar_entry.cpp
│ │ ├── action_bar_entry.h
│ │ ├── action_bar_profile.cpp
│ │ └── action_bar_profile.h
│ ├── class_profile.cpp
│ ├── class_profile.h
│ ├── input/
│ │ ├── input_profile.cpp
│ │ ├── input_profile.h
│ │ ├── input_profile_modifier.cpp
│ │ ├── input_profile_modifier.h
│ │ ├── input_profile_modifier_entry.cpp
│ │ └── input_profile_modifier_entry.h
│ ├── player_profile.cpp
│ └── player_profile.h
├── projectiles/
│ └── 3d/
│ ├── spell_follow_projectile_3d.cpp
│ └── spell_follow_projectile_3d.h
├── props/
│ ├── prop_data_entity.cpp
│ └── prop_data_entity.h
├── register_types.cpp
├── register_types.h
├── singletons/
│ ├── ess.cpp
│ ├── ess.h
│ ├── profile_manager.cpp
│ └── profile_manager.h
├── skeleton/
│ ├── character_bones.cpp
│ ├── character_bones.h
│ ├── character_skeleton_2d.cpp
│ ├── character_skeleton_2d.h
│ ├── character_skeleton_3d.cpp
│ ├── character_skeleton_3d.h
│ ├── entity_skeleton_data.cpp
│ ├── entity_skeleton_data.h
│ ├── skeleton_model_entry.cpp
│ └── skeleton_model_entry.h
├── spawners/
│ ├── ess_entity_spawner.cpp
│ └── ess_entity_spawner.h
├── spell_enums.cpp
├── spell_enums.h
└── utility/
├── entity_create_info.cpp
└── entity_create_info.h
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.import
*.d
*.o
*.meta
*.obj
*.pyc
*.bc
*.os
================================================
FILE: LICENSE
================================================
Copyright (c) 2019-2022 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.
================================================
FILE: README.md
================================================
# Entity Spell System
An entity and spell system for the GODOT Engine, that is usable for both 2d, and 3d games. The main purpose of this
module is to handle spells, auras, and most entity-related things like spawning, items, inventory, containers,
vendors, interaction, targeting, equipment (+ visuals), loot, crafting, talents, pets, npcs, etc ...
The module supports networking. It is designed to be authoritative, so players shouldn't be able to cheat by design.
It is a c++ engine module, which means you will need to compile it into godot. (See compiling)
## Godot Version Support
This branch tries to follow godot's master branch (as much as I have time).
For different godot versions look at the other branches.
Status for this branch: Update for 4.0 is still work in progress. Godot's virtual method binding rework hit this module
extremely hard, to the point where I'm seriously considering reworking most of the virtuals
to use a `_notification()`-like interface.
## Project setup tl;dr
### First
You need to create an `ESSResourceDB` resource somewhere in you project. (Or alloocate it dynamically.)
Now you can either:
-Go to `ProjectSettings->Ess->Data`, and set the `ess_resource_db_path` property also make sure that `automatic_load` is on.
-Or you can load it yourself and set it into the `ESS` singleton either using the `resource_db` property.
### Second
You need to add an `ESSEntitySpawner` somewhere into your SceneTree. I recommend that you create an autoload for it.
This is where you have to implement your spawning logic.
### What the module doesn't cover
Movement, and controls.
Unfortunately, there isn't a one-stop-shop solution for movement, especially if we throw networking into the mix,
and the same is true for targeting. This means that this module cannot really do much in this regard, but it will
give you as much help to set everything up as possible.
## Optional Dependencies
Mesh Data Resource
https://github.com/Relintai/mesh_data_resource.git
Adds mesh (MeshDataResource) support to ModelVisuals.
## Pre-built binaries
You can grab a pre-built editor binary from the [Broken Seals](https://github.com/Relintai/broken_seals/releases)
repo, should you want to. It contains all my modules.
## Overview
The module provides a huge number of script callbacks, usually as virtual methods they usually start with an underscore.
Do not call methods with underscores, all of them has a normal counterpart, always call that.
For example entity has `crafts(int id)` and `_crafts(int id)` (virtual). Always use `crafts(int id)`, it will
call `_crafts(int id)`.
For networked classes, every variable is broken up into clientside, and serverside. This makes it easier to
develop games that can also run locally, with less overhead and simpler logic.
E.g. this makes it easy to use the visibility system even when you play locally on the server, because you just use the clientside variables,
and your logic will work the same way.
## Settings
Entity and spell system comes with quite a few settings, you can find these under `ProjectSettings->Ess`.
## Singletons
The module contains 2 singletons. `ESS`, and `ProfileManager`. Both are accessible from scripts.
### The ESS singleton
Contains the active `ESSResourceDB` instance, and for convenience a reference to the active `ESSEntitySpawner`
instance. Also loads/handles/processes all of the entity and spell system related ProjectSettings, so if you need
any ESS related value from ProjectSettings, don't query it directly, get it from this singleton.
Customizable enums values are preprocessed, and you usually have multiple ways of getting them.
### The ProfileManager singleton
Contains methods to easily load/save/handle `PlayerProfile`s.
#### PlayerProfile
Contains player-related data, most notably `ClassProfile`s.
#### ClassProfile
Contains class-related data, most notably `ActionBarProfile`s, and `InputProfiles`.
#### ActionBarProfile
Contains the data for a set of actionbars.
#### InputProfileswd
Contains the keybind data for a class.
## Enums
ESS needs lots of enums to work, and to reduce complexity with includes they ended up in a few separate classes.
I'm still in the process of converting these to be customizable (`ESS` singleton / ProjectSettings).
(Only the ones that worth it will be converted.)
### EntityEnums
Contains Entity-related enums, like AIStates, skeleton attach points, entity flags, immunity flags,
state flags.
### ItemEnums
Contains item-related enums, like rarity, armor type, item types.
### SpellEnums
Contains spell-related enums, like aura types, damage types, spell categories, spell types, trigger types,
and quite a few notification constants.
### Customizable enums
Open `ProjectSettings`, and then go to `ESS/Enums`.
All of the string properties are customizable enums. These require a comma-separated list.
They are essentially a godot comma separated property hint enum string.
They all have defaults.
Fer example:
If you want you game to work with the following stats: Agility,Intellect,Crit,Weapon Damage,Stamina
and you want Agility,Intellect,Stamina as you main stats.
Firstly you want to put you main stats at the beginning, because the system will take the first `main_stat_count`
stats as main stats.
And then just enter `Agility,Intellect,Stamina,Crit,Weapon Damage` into the `stats` setting, and then
set `main_stat_count` to 3.
When these values are expected to be used as properties, the `ESS` singleton will create snake_cased versions automatically.
`String stat_get_property_name(id: int) const` inside the ESS singleton for example.
So in the example case `ESS.stat_get_property_name(4)` would return `weapon_damage`.
## ESSResourceDB
This is a class that maps ids to resources for quick lookups.
This is necessary in order to support networking, because you don't want to send resource paths over the network
every time somebody casts a spell for example.
### ESSResourceDBStatic
Simple static resource db. Just drag and drop all your data that you use into it with the inspector.
Stores the data as vectors.
Supports id remapping, which means that it can assign new ids to all added resources, so they don't clash.
The added resource's index will be set as it's id.
This is useful for modding support, as you can just collect every mod's resource dbs, and add them to a static db,
and with this option enabled the ids will not clash.
You can see an example of this [here](https://github.com/Relintai/broken_seals/blob/master/game/scripts/game_modules/DataManager.gd).
### ESSResourceDBMap
Stores everything as a vector, and a map.
#### ESSResourceDBFolders
Inherited from `ESSResourceDBMap`.
It will load everything from the folders that you set up into it's `folders` property.
## Entity
This is the main class that can be used for players/mobs/npcs and also other things like chests.
I ended up merging subclass functionality into it, because
that way it gains a lot more utility, by sacrificing only a small amount of memory.
For example this way it is easy to make chests attack the player, or make spell that animate objects.
## Entity Body
Originally entities used to be inherited from `Spatial` or `Node2D`, so they could contain/drive their own models,
but eventually on order to support both 2d, and 3d, bodies were separated from them. This unfortunately
complicates the setup a bit, but the upsides overweight the downsides, as this way you don't need to create different
entities for every model/body you have.
Bodies are stored at `EntityData->EntitySpeciesData->ModelDatas (SpeciesModelData)->Body`
When an `Entity` gets initialized, it will instance it's body automatically, but if you want to intance it yourself,
you can call `void instance_body(entity_data: EntityData, model_index: int)` on an `Entity`.
The `model_index` property tell the `Entity` which one it should use.
Instancing bodies does not happen immediately, but you will probably want to set an `Entity`'s position right where
you create it, a few helpers were added:\
`void set_transform_2d(transform: Transform2D, only_stored: bool = false)`\
`void set_transform_3d(transform: Transform, only_stored: bool = false)`
Your body implementation then can get this from an entity an set itself to the right place.
### CharacterSkeletons
CharacterSkeletons handle the looks of your characters.
They come in two variants, one for 2d, one for 3d.
They have quite a few helper methods.
They can store ModelVisuals, and ModelVisualEntries.
They support attach points. For example a character's hand.
It adds properties based on the selected entity_type.
These are based on the values from `ProjectSettings->ESS->Enums->skeletons_bone_attachment_points`.
If you want to merge meshes this is where you can implement it.
#### CharacterSkeleton3D
The 3d variant.
[Complex 3d skeleton scene](https://github.com/Relintai/broken_seals/blob/master/game/models/entities/human/models/armature_huf.tscn) \
[Complex 3d skeleton script](https://github.com/Relintai/broken_seals/blob/master/game/player/CharacterSkeletonGD.gd)
#### CharacterSkeleton2D
The 2d variant.
[Simple 2d roguelike skeleton script](https://github.com/Relintai/broken_seals_roguelike/blob/master/game/characters/SimpleCharacter.gd) \
[Simple 2d roguelike skeleton scene](https://github.com/Relintai/broken_seals_roguelike/blob/master/game/characters/SimpleCharacter.tscn)
#### ModelVisual
A collection ModelVisualEntries.
You will need to use this to define a look. For example if you have an item that will change your character's clothes,
you will use this.
##### ModelVisualEntry
Contains meshes, textures, texture tints, mesh transforms.
It has 2 modes, `Bone` and `Attachment`.
In the bone mode, you need to select an entity type, and then a concrete bone. This is the "merge this into the final character mesh" mode.
In the attachment mode, you need to select a common attach point (`ProjectSettings->Ess->enums->skeletons_bone_attachment_points`),
and the containing mesh will be put on to that point by the CharacterSkeleton. This is how you can implement weapons for example.
### EntitySpeciesData
Contains data related to a species, like `SpeciesModelData`s, and species specific spells, and auras.
#### SpeciesModelData
Contains a scene of a species's body and it's customizations.
The `customizable_slots_string` and `customizable_colors_string` should be filled with a comma separated string,
they will add properties. Currently you need to click on something else, and back on the resource for these to show up,
after a change to the strings.
The body can be any scene, Entity will instance it, and set it to it's body property.
The body should handle movement based on the player's input, it should handle sending position information through the network,
if you want networking, it might (`CharacterSkeleton`s can also do it) also drive your animations/animation players if you have it.
Bodies does not need to handle the graphics themselves (`ModelVisualEntries` for example) (you can implement your logic here
if you want to), but the `CharacterSkeleton` classes exist for that purpose.
[Complex 3d body script](https://github.com/Relintai/broken_seals/blob/master/game/player/Body.gd) \
[Complex 3d body scene](https://github.com/Relintai/broken_seals/blob/master/game/models/entities/human/models/HumanFemale.tscn)
[Simple 2d roguelike body script](https://github.com/Relintai/broken_seals_roguelike/blob/master/game/player/Body.gd) \
[Simple 2d roguelike body scene](https://github.com/Relintai/broken_seals_roguelike/blob/master/game/player/Body.gd)
#### SpeciesInstance
This class will store character model customization data. E.g. which hairstyle you want for an `Entity`.
Not yet finished!
### Spawning
Since spawning (= creating) entities is entirely dependent on the type of game you are making, ESS cannot do
everything for you. It will set up stats, equipment etc, but there is no way to set up positions for example.
You can implement your spawning logic by inheriting from `ESSEntitySpawner`, and implementing `_request_entity_spawn`.
You should only have one spawner at any given time. It will register itself into the ESS singleton automatically.
Since it is inherited from Node, I recommend that you create an autoload for it.
The ESS singleton also contains convenience methods to request spawning an Entity.
[Sample 3d spawner implementation](https://github.com/Relintai/broken_seals/blob/master/game/player/bs_entity_spawner.gd) \
[Sample 2d spawner implementation](https://github.com/Relintai/broken_seals_roguelike/blob/master/game/player/bs_entity_spawner.gd)
#### EntityCreateInfo
Entity spawning usually requires a lot of complexity and hassle, this helper class aims to make it painless.
All methods that deal with spawning will take this as a parameter.
### EntityData
Since setting up Entities as scenes is usually quite the hassle, `EntityData` had to be created.
It stores everything an entity needs.
In order to spawn an entity you need it.
#### EntityClassData
`EntityClassData` holds class-related information, like specs (`CharacterSpec`), spells, start spells, start auras,
alternative ais, `EntityResource`s (mana for example).
#### CharacterSpec
`CharacterSpec` holds spec-related information, most notably talents.
#### EntityResource
EntityResources are things like mana, health, or speed. These add greater flexibility over stats.
The resource system is quite flexible, if you add a resource serverside, it will be automatically
added clientside. (You have to add `EntityResource`s to the active `ESSResourceDB`!)
By default all entities have the build in speed and health resources, as a set index
(`EntityEnums::ENTITY_RESOURCE_INDEX_HEALTH` and `EntityEnums::ENTITY_RESOURCE_INDEX_SPEED`).
There is also the `EntityEnums::ENTITY_RESOURCE_INDEX_RESOURCES_BEGIN` constant, so you have
the current offset where the custom resources start.
Entity allocates these in it's `_initialize()` virtual method, if you want to customize them.
Note that `EntityClassData` contains an array, so you can add more resources easily to classes,
these will be automatically added when the system initializes an `Entity`.
##### EntityResourceHealth
The standard health resource implementation.
##### EntityResourceSpeed
The standard speed resource implementation.
#### EntityResourceCostData
This is the class taht lets you implement resource costs. For example mana cost for a spell.
##### EntityResourceCostDataResource
The standard resource cost implementation.
##### EntityResourceCostDataHealth
The standard health resource cost implementation.
It has a resource property, so you can just assign any resource to this.
### Interactions
If you want your player to interact with it's target. For example a vendor, or loot.
First make sure that you can interact, by checking `Entity.cans_interact()` or `Entity.canc_interact()`.
If this returns true, you can call `Entity.crequest_interact()`. This will call `Entity.sinteract()` serverside.
Interactions are handled by `EntityData` by default. It has the same methods. If `EntityData` is not set, the `Entity`
will try to call the same overridable on itself.
You can see an example implementation [here](https://github.com/Relintai/broken_seals/blob/master/game/scripts/entities/EntityDataGD.gd).
### AI
You can implement ai by extending `EntityAI`, and then assigning it to an `EntityData`.
When an `Entity` gets spawned it will create a copy for itself, so you can safely use class variables.
#### AIFormation
Not yet finished, it was meant as a way to calculate offset pet positions, (If an `Entity` has let's say
4 pets you don't just want them all to stay on top of their controller).
If this functionality ends up in `EntityAI`, after pets are finished, this will be removed.
### Pets
Unfortunately pet support is not yet finished.
It is mostly done though, so you will see pet-related methods scattered around.
### Bags
Stores items. See `Bag`. It has quite a few virtual methods, you should be able to implement most inventory types
should you want to.
Entity will send these over the network.
Also Entities have a target bag property. For example this makes vendors easily implementable.
### VRPCs
Entities has a networked visibility system. The method itself is called `vrpc`, it works the same way as normal rpcs.
If you want to send data to every client that sees the current entity, use this.
## Spells, Auras, Talents
Spell is the class you need to create both spells, and aura.\
It stores the data, and also it has the ability to be scripted.\
Talents are actually just spells used as Auras. Right now the system just applies them as a permanent aura.\
You don't need to worry about applying auras, cast them as spells instead. It they are set to permanent, or they have a duration set they will be applied as an aura automatically.
Talent ranks are implemented by deapplying the earlier rank first, then applying the new rank.
### How to
Request casting a spell clientside: `void spell_crequest_cast(spell_id: int)` \
Request to learn a spell clientside: `void spell_learn_requestc(id: int)`
Request talent learning clientside: \
`void character_talent_crequest_learn(spec_index: int, character_talent_row: int, character_talent_culomn: int)` or \
`void class_talent_crequest_learn(spec_index: int, class_talent_row: int, class_talent_culomn: int)`
#### Cast a spell
Note that you should only do this serverside.
```
# Or get it from the active ESSResourceDB, etc
export(Spell) var spell : Spell
func scast_spell() -> void:
var sci : SpellCastInfo = SpellCastInfo.new()
sci.caster = info.caster
sci.target = info.target
sci.has_cast_time = spell.cast_enabled
sci.cast_time = spell.cast_cast_time
sci.spell_scale = info.spell_scale
sci.set_spell(spell)
spell.cast_starts(sci)
```
#### Apply an aura
Normally you shouldn't do this, this is for more advanced uses. Cast the aura as a spell instead.
Note that you should only apply auras serverside, they will be sent to clients automatically.
```
# Or get it from the active ESSResourceDB, etc
export(Spell) var aura : Spell
func sapply_aura() -> void:
var ainfo : AuraApplyInfo = AuraApplyInfo.new()
ainfo.caster = info.caster
ainfo.target = info.caster
ainfo.spell_scale = 1
ainfo.aura = aura
aura.sapply(ainfo)
```
#### UI
[Complete UI Implemetation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player)
[Player UI Core Implemetation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/player_ui)
[Aura Frame Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/auraframe) \
[Castbar Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/castbar) \
[Unitframe Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/unitframes)
[Actionbar Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/actionbars)
[Character Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/character) \
[Inventory Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/bags) \
[Crafting Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/crafting) \
[Loot Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/loot_window) \
[Talent Window Implemetation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/talents) \
[Spellbook Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/spellbook) \
[Vendor Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/vendor_window) \
[Trainer Window Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/trainer)
[3D Nameplate Implementation](https://github.com/Relintai/broken_seals/tree/master/game/ui/world/nameplates) \
[2D Nameplate Implementation](https://github.com/Relintai/broken_seals_roguelike/tree/master/game/ui/nameplates)
### Infos / Pipelines
#### SpellCastInfo
Stores information about the state of a spell's cast.
#### AuraApplyInfo
Helps to apply auras
#### SpellDamageInfo, SpellHealInfo
These are used in the damage and heal calculation. For example these can be used to implement immunities, or absorb effects
by modifying their damage values in aura callbacks.
### Projectiles
Spells support projectiles, they are created/set up inside `void handle_projectile(info: SpellCastInfo)`.
The default implementation will instance `Spell`'s projectile scene (if set), and then it will try to call a
`void setup_projectile(info: SpellCastInfo)` on it if exists.
You can override this behaviour by implementing your own `_void handle_projectile(info: SpellCastInfo)` on `Spell`
Note that the module already adds `SpellFollowProjectile3D`, but this has not been finished yet.
## Items
Items are implemented using 2 classes, `ItemTemplate`, and `ItemInstance`.
`ItemTemplate` contains all information for a potential item. You can generate `Iteminstance`s with this,
using it's `ItemInstance create_item_instance()` method. You can also implement your custom item creation logic
using the `void _create_item_instance()` virtual.
`ItemInstance` is the actual item.
### Loot
Looting can be implemented using `Entity`'s target bag functionality.
You can see an example implementation [here](https://github.com/Relintai/broken_seals/blob/master/game/scripts/entities/EntityDataGD.gd). \
And an example ui implementation [here](https://github.com/Relintai/broken_seals/tree/master/game/ui/player/loot_window).
## XP
You can set all the xp values for your levels in `ProjectSettings->Ess->xp`.
Now you can start distributing xp, for whatever you'd like to Entities, using `Entity.xp_adds(vlaue : int)`
## Examples
Eventually I'll create a separate repository with a few examples/demos, but for now you can check the game
I've been working on for examples.
3d:
https://github.com/Relintai/broken_seals.git
2d turn based:
https://github.com/Relintai/broken_seals_roguelike
2d:
https://github.com/Relintai/broken_seals_2d.git
## Compiling
First make sure that you can compile godot. See the official docs: https://docs.godotengine.org/en/3.x/development/compiling/index.html
1. Clone the engine if you haven't already:
If you want Godot 3.x:
```git clone -b 3.x https://github.com/godotengine/godot.git godot```
If you want Godot 4.0:
```git clone https://github.com/godotengine/godot.git godot```
2. go into the modules folder inside the engine's directory"
```cd godot```
```cd modules```
3. clone this repository
```git clone https://github.com/Relintai/entity_spell_system.git entity_spell_system```
(the folder needs to be named entity_spell_system!)
4. Go up one folder
```cd ..```
5. Compile godot.
For example:
```scons p=x11 t=release_debug tools=yes```
================================================
FILE: SCsub
================================================
import os
Import('env')
module_env = env.Clone()
if os.path.isdir('../mesh_data_resource'):
module_env.Append(CPPDEFINES=['MESH_DATA_RESOURCE_PRESENT'])
if os.path.isdir('../props'):
module_env.Append(CPPDEFINES=['PROPS_PRESENT'])
has_texture_packer = False
if os.path.isdir('../texture_packer'):
has_texture_packer = True
module_env.Append(CPPDEFINES=['TEXTURE_PACKER_PRESENT'])
sources = [
"register_types.cpp",
"entity_enums.cpp",
"spell_enums.cpp",
"item_enums.cpp",
"data/auras/aura_group.cpp",
"data/items/item_instance.cpp",
"data/items/item_template.cpp",
"data/items/equipment_data.cpp",
"data/items/craft_recipe_helper.cpp",
"data/items/craft_recipe.cpp",
"data/items/model_visual.cpp",
"data/items/model_visual_entry.cpp",
"data/species/entity_species_data.cpp",
"data/species/species_model_data.cpp",
"data/species/species_instance.cpp",
"data/spells/spell_cooldown_manipulation_data.cpp",
"data/spells/spell.cpp",
"data/spells/spell_effect_visual.cpp",
"data/spells/spell_effect_visual_simple.cpp",
"data/atlases/character_atlas.cpp",
"data/atlases/character_atlas_entry.cpp",
"entities/data/entity_data.cpp",
"entities/data/entity_class_data.cpp",
"entities/data/vendor_item_data.cpp",
"entities/data/vendor_item_data_entry.cpp",
"entities/data/entity_data_container.cpp",
"entities/data/item_container_data.cpp",
"entities/data/item_container_data_entry.cpp",
"entities/skills/entity_skill.cpp",
"entities/skills/entity_skill_data.cpp",
"entities/data/character_spec.cpp",
"skeleton/character_bones.cpp",
"entities/stats/stat_data.cpp",
"entities/stats/level_stat_data.cpp",
"entities/stats/simple_level_stat_data.cpp",
"entities/stats/complex_level_stat_data.cpp",
"inventory/bag.cpp",
#"inventory/inventory.cpp",
"infos/aura_infos.cpp",
"infos/spell_cast_info.cpp",
"pipelines/spell_damage_info.cpp",
"pipelines/spell_heal_info.cpp",
"entities/auras/aura_data.cpp",
"entities/entity.cpp",
"entities/resources/entity_resource_cost_data.cpp",
"entities/resources/entity_resource_cost_data_health.cpp",
"entities/resources/entity_resource_cost_data_resource.cpp",
"entities/resources/entity_resource.cpp",
"entities/resources/entity_resource_health.cpp",
"entities/resources/entity_resource_speed.cpp",
"drag_and_drop/es_drag_and_drop.cpp",
"skeleton/character_skeleton_2d.cpp",
"skeleton/character_skeleton_3d.cpp",
"skeleton/skeleton_model_entry.cpp",
"utility/entity_create_info.cpp",
"data/loot/loot_data_base.cpp",
"entities/ai/entity_ai.cpp",
"formations/ai_formation.cpp",
"projectiles/3d/spell_follow_projectile_3d.cpp",
"profiles/input/input_profile_modifier.cpp",
"profiles/input/input_profile_modifier_entry.cpp",
"profiles/input/input_profile.cpp",
"profiles/actionbar/action_bar_button_entry.cpp",
"profiles/actionbar/action_bar_entry.cpp",
"profiles/actionbar/action_bar_profile.cpp",
"profiles/class_profile.cpp",
"profiles/player_profile.cpp",
"spawners/ess_entity_spawner.cpp",
"singletons/profile_manager.cpp",
"singletons/ess.cpp",
"database/ess_resource_db.cpp",
"database/ess_resource_db_static.cpp",
"database/ess_resource_db_map.cpp",
"database/ess_resource_db_folders.cpp",
"editor/ess_editor_plugin.cpp",
"props/prop_data_entity.cpp",
"material_cache/ess_material_cache.cpp"
]
if has_texture_packer:
sources.append("material_cache/ess_material_cache_pcm.cpp")
if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes':
# Shared lib compilation
module_env.Append(CCFLAGS=['-fPIC'])
module_env['LIBS'] = []
shared_lib = module_env.SharedLibrary(target='#bin/ess', source=sources)
shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0]
env.Append(LIBS=[shared_lib_shim])
env.Append(LIBPATH=['#bin'])
else:
# Static compilation
module_env.add_source_files(env.modules_sources, sources)
================================================
FILE: config.py
================================================
def can_build(env, platform):
return True
def configure(env):
pass
def get_doc_classes():
return [
"CharacterAtlasEntry",
"CharacterAtlas",
"ESS",
"AuraGroup",
"CraftRecipeHelper",
"CraftRecipe",
"EquipmentData",
"ItemInstance",
"ItemTemplate",
"ModelVisualEntry",
"ModelVisual",
"SpellCooldownManipulationData",
"SpellEffectVisualSimple",
"SpellEffectVisual",
"Spell",
"ESDragAndDrop",
"EntityAI",
"AuraData",
"CharacterSpec",
"EntityClassData",
"EntityDataContainer",
"EntityData",
"ItemContainerDataEntry",
"ItemContainerData",
"VendorItemDataEntry",
"VendorItemData",
"EntityResourceCostData",
"EntityResourceCostDataHealth",
"EntityResourceCostDataResource",
"EntityResource",
"EntityResourceHealth",
"EntityResourceSpeed",
"EntitySkillData",
"EntitySkill",
"ComplexLevelStatData",
"LevelStatData",
"SimpleLevelStatData",
"StatData",
"StatModifier",
"Entity",
"AIFormation",
"AuraApplyInfo",
"SpellCastInfo",
"Bag",
"LootDataBase",
"SpellDamageInfo",
"SpellHealInfo",
"ActionBarButtonEntry",
"ActionBarEntry",
"ActionBarProfile",
"InputProfileModifierEntry",
"InputProfileModifier",
"InputProfile",
"ClassProfile",
"PlayerProfile",
"ProfileManager",
"CharacterBones",
"CharacterSkeleton3D",
"CharacterSkeleton2D",
"CharacterSkeleton",
"EntitySpeciesData",
"SpeciesInstance",
"SkeletonModelEntry",
"SpeciesModelData",
"EntityCreateInfo",
"SpellFollowProjectile3D",
"ESSResourceDB",
"ESSResourceDBFolders",
"ESSResourceDBStatic",
"ESSResourceDBMap",
"EntityEnums",
"ItemEnums",
"SpellEnums",
"ESSEntitySpawner",
"PropDataEntity",
"ESSMaterialCache",
"ESSMaterialCachePCM",
]
def get_doc_path():
return "doc_classes"
================================================
FILE: data/atlases/character_atlas.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "character_atlas.h"
CharacterAtlas::CharacterAtlas() {
}
void CharacterAtlas::_bind_methods() {
}
================================================
FILE: data/atlases/character_atlas.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef CHARACTER_ATLAS_H
#define CHARACTER_ATLAS_H
#include "core/version.h"
#include "core/io/resource.h"
class CharacterAtlas : public Resource {
GDCLASS(CharacterAtlas, Resource);
public:
CharacterAtlas();
protected:
static void _bind_methods();
//private:
};
#endif
================================================
FILE: data/atlases/character_atlas_entry.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "character_atlas_entry.h"
CharacterAtlasEntry::CharacterAtlasEntry() {
}
void CharacterAtlasEntry::_bind_methods() {
}
================================================
FILE: data/atlases/character_atlas_entry.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef CHARACTER_ATLAS_ENTRY_H
#define CHARACTER_ATLAS_ENTRY_H
#include "core/version.h"
#include "core/io/resource.h"
class CharacterAtlasEntry : public Resource {
GDCLASS(CharacterAtlasEntry, Resource);
public:
CharacterAtlasEntry();
protected:
static void _bind_methods();
//private:
};
#endif
================================================
FILE: data/auras/aura_group.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "aura_group.h"
AuraGroup::AuraGroup() {
}
void AuraGroup::_bind_methods() {
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_description"), "set_name", "get_name");
}
================================================
FILE: data/auras/aura_group.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef AURA_GROUP_H
#define AURA_GROUP_H
#include "core/version.h"
#include "core/io/resource.h"
class AuraGroup : public Resource {
GDCLASS(AuraGroup, Resource);
public:
AuraGroup();
protected:
static void _bind_methods();
};
#endif
================================================
FILE: data/items/craft_recipe.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "craft_recipe.h"
const String CraftRecipe::BINDING_STRING_CRAFT_CATEGORIES = "None,Alchemy,Smithing,Tailoring,Enchanting,Engineering";
const String CraftRecipe::BINDING_STRING_CRAFT_SUB_CATEGORIES = "None,Potions";
int CraftRecipe::get_id() const {
return _id;
}
void CraftRecipe::set_id(const int value) {
_id = value;
}
CraftRecipe::CraftCategories CraftRecipe::get_category() const {
return _category;
}
void CraftRecipe::set_category(const CraftCategories value) {
_category = value;
}
CraftRecipe::CraftSubCategories CraftRecipe::get_sub_category() const {
return _sub_category;
}
void CraftRecipe::set_sub_category(const CraftSubCategories value) {
_sub_category = value;
}
Ref<CraftRecipeHelper> CraftRecipe::get_required_tool(const int index) {
return _required_tools[index];
}
void CraftRecipe::set_required_tool(const int index, const Ref<CraftRecipeHelper> &value) {
_required_tools[index] = value;
}
int CraftRecipe::get_required_tools_count() const {
return _required_tools_count;
}
void CraftRecipe::set_required_tools_count(const int value) {
_required_tools_count = value;
}
void CraftRecipe::set_required_material(const int index, const Ref<CraftRecipeHelper> &value) {
_required_materials[index] = value;
}
Ref<CraftRecipeHelper> CraftRecipe::get_required_material(int index) {
return _required_materials[index];
}
int CraftRecipe::get_required_materials_count() const {
return _required_materials_count;
}
void CraftRecipe::set_required_materials_count(const int value) {
_required_materials_count = value;
}
Ref<CraftRecipeHelper> CraftRecipe::get_item() {
return _item;
}
void CraftRecipe::set_item(const Ref<CraftRecipeHelper> &value) {
_item = value;
}
CraftRecipe::CraftRecipe() {
_id = 0;
_category = CraftCategories::CRAFT_CATEGORY_NONE;
_sub_category = CraftSubCategories::CRAFT_SUB_CATEGORY_NONE;
//_item = Ref<CraftRecipeHelper>(memnew(CraftRecipeHelper()));
_required_materials_count = 0;
_required_tools_count = 0;
//for (int i = 0; i < MAX_REQUIRED_TOOLS; ++i) {
// _required_tools[i] = Ref<CraftRecipeHelper>(memnew(CraftRecipeHelper()));
//}
//for (int i = 0; i < MAX_REQUIRED_MATERIALS; ++i) {
// _required_materials[i] = Ref<CraftRecipeHelper>(memnew(CraftRecipeHelper()));
//}
}
CraftRecipe::~CraftRecipe() {
//TODO check if the array destrutors actually unref the objects.
//_item = Ref<CraftRecipeHelper>(NULL);
}
void CraftRecipe::_validate_property(PropertyInfo &property) const {
String prop = property.name;
if (prop.begins_with("RequiredMaterials_")) {
int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int();
if (frame >= _required_materials_count) {
property.usage = 0;
}
} else if (prop.begins_with("RequiredTools_")) {
int frame = prop.get_slicec('/', 0).get_slicec('_', 1).to_int();
if (frame >= _required_tools_count) {
property.usage = 0;
}
}
}
void CraftRecipe::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_id"), &CraftRecipe::get_id);
ClassDB::bind_method(D_METHOD("set_id", "value"), &CraftRecipe::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
ClassDB::bind_method(D_METHOD("get_category"), &CraftRecipe::get_category);
ClassDB::bind_method(D_METHOD("set_category", "value"), &CraftRecipe::set_category);
ADD_PROPERTY(PropertyInfo(Variant::INT, "category", PROPERTY_HINT_ENUM, CraftRecipe::BINDING_STRING_CRAFT_CATEGORIES), "set_category", "get_category");
ClassDB::bind_method(D_METHOD("get_sub_category"), &CraftRecipe::get_sub_category);
ClassDB::bind_method(D_METHOD("set_sub_category", "value"), &CraftRecipe::set_sub_category);
ADD_PROPERTY(PropertyInfo(Variant::INT, "sub_category", PROPERTY_HINT_ENUM, CraftRecipe::BINDING_STRING_CRAFT_SUB_CATEGORIES), "set_sub_category", "get_sub_category");
ClassDB::bind_method(D_METHOD("get_required_material"), &CraftRecipe::get_required_material);
ClassDB::bind_method(D_METHOD("set_required_material", "mat"), &CraftRecipe::set_required_material);
ClassDB::bind_method(D_METHOD("get_required_materials_count"), &CraftRecipe::get_required_materials_count);
ClassDB::bind_method(D_METHOD("set_required_materials_count", "count"), &CraftRecipe::set_required_materials_count);
ADD_PROPERTY(PropertyInfo(Variant::INT, "required_materials_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_REQUIRED_MATERIALS), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_required_materials_count", "get_required_materials_count");
for (int i = 0; i < MAX_REQUIRED_MATERIALS; i++) {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "RequiredMaterials_" + itos(i) + "", PROPERTY_HINT_RESOURCE_TYPE, "CraftRecipeHelper", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_required_material", "get_required_material", i);
}
ClassDB::bind_method(D_METHOD("get_required_tool"), &CraftRecipe::get_required_tool);
ClassDB::bind_method(D_METHOD("set_required_tool", "value"), &CraftRecipe::set_required_tool);
ClassDB::bind_method(D_METHOD("get_required_tools_count"), &CraftRecipe::get_required_tools_count);
ClassDB::bind_method(D_METHOD("set_required_tools_count", "value"), &CraftRecipe::set_required_tools_count);
ADD_PROPERTY(PropertyInfo(Variant::INT, "required_tools_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_REQUIRED_TOOLS), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_required_tools_count", "get_required_tools_count");
for (int i = 0; i < MAX_REQUIRED_TOOLS; i++) {
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "RequiredTools_" + itos(i), PROPERTY_HINT_RESOURCE_TYPE, "CraftRecipeHelper", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "set_required_tool", "get_required_tool", i);
}
ClassDB::bind_method(D_METHOD("get_item"), &CraftRecipe::get_item);
ClassDB::bind_method(D_METHOD("set_item", "value"), &CraftRecipe::set_item);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "CraftRecipeHelper"), "set_item", "get_item");
BIND_CONSTANT(MAX_REQUIRED_TOOLS);
BIND_CONSTANT(MAX_REQUIRED_MATERIALS);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_NONE);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_ALCHEMY);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_SMITHING);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_TAILORING);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_ENCHANTING);
BIND_ENUM_CONSTANT(CRAFT_CATEGORY_ENGINEERING);
BIND_ENUM_CONSTANT(CRAFT_SUB_CATEGORY_NONE);
BIND_ENUM_CONSTANT(CRAFT_SUB_CATEGORY_POTIONS);
}
================================================
FILE: data/items/craft_recipe.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef CRAFT_RECIPE_H
#define CRAFT_RECIPE_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/templates/vector.h"
#include "core/string/ustring.h"
#include "item_template.h"
#include "craft_recipe_helper.h"
class CraftRecipe : public Resource {
GDCLASS(CraftRecipe, Resource);
public:
static const String BINDING_STRING_CRAFT_CATEGORIES;
static const String BINDING_STRING_CRAFT_SUB_CATEGORIES;
enum CraftCategories {
CRAFT_CATEGORY_NONE,
CRAFT_CATEGORY_ALCHEMY,
CRAFT_CATEGORY_SMITHING,
CRAFT_CATEGORY_TAILORING,
CRAFT_CATEGORY_ENCHANTING,
CRAFT_CATEGORY_ENGINEERING,
};
enum CraftSubCategories {
CRAFT_SUB_CATEGORY_NONE,
CRAFT_SUB_CATEGORY_POTIONS,
};
public:
int get_id() const;
void set_id(const int value);
CraftCategories get_category() const;
void set_category(const CraftCategories value);
CraftSubCategories get_sub_category() const;
void set_sub_category(const CraftSubCategories value);
//Tools
Ref<CraftRecipeHelper> get_required_tool(int index);
void set_required_tool(const int index, const Ref<CraftRecipeHelper> &value);
int get_required_tools_count() const;
void set_required_tools_count(const int value);
//Materials
Ref<CraftRecipeHelper> get_required_material(const int index);
void set_required_material(const int index, const Ref<CraftRecipeHelper> &value);
int get_required_materials_count() const;
void set_required_materials_count(const int value);
//Item
Ref<CraftRecipeHelper> get_item();
void set_item(const Ref<CraftRecipeHelper> &value);
CraftRecipe();
~CraftRecipe();
protected:
static void _bind_methods();
void _validate_property(PropertyInfo &property) const;
private:
enum {
MAX_REQUIRED_MATERIALS = 6, //Increase if necessary, should be enough for now
MAX_REQUIRED_TOOLS = 6 //Increase if necessary, should be enough for now
};
int _id;
String _text_name;
CraftCategories _category;
CraftSubCategories _sub_category;
int _required_tools_count;
Ref<CraftRecipeHelper> _required_tools[MAX_REQUIRED_TOOLS];
int _required_materials_count;
Ref<CraftRecipeHelper> _required_materials[MAX_REQUIRED_MATERIALS];
Ref<CraftRecipeHelper> _item;
};
VARIANT_ENUM_CAST(CraftRecipe::CraftSubCategories);
VARIANT_ENUM_CAST(CraftRecipe::CraftCategories);
#endif
================================================
FILE: data/items/craft_recipe_helper.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "craft_recipe_helper.h"
Ref<ItemTemplate> CraftRecipeHelper::get_item() {
return _item;
}
void CraftRecipeHelper::set_item(Ref<ItemTemplate> value) {
_item = value;
}
int CraftRecipeHelper::get_count() {
return _count;
}
void CraftRecipeHelper::set_count(int value) {
_count = value;
}
CraftRecipeHelper::CraftRecipeHelper(Ref<ItemTemplate> item, int count) {
set_item(item);
set_count(count);
}
CraftRecipeHelper::CraftRecipeHelper() {
set_count(0);
}
CraftRecipeHelper::~CraftRecipeHelper() {
}
void CraftRecipeHelper::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_item"), &CraftRecipeHelper::get_item);
ClassDB::bind_method(D_METHOD("set_item", "value"), &CraftRecipeHelper::set_item);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate"), "set_item", "get_item");
ClassDB::bind_method(D_METHOD("get_count"), &CraftRecipeHelper::get_count);
ClassDB::bind_method(D_METHOD("set_count", "value"), &CraftRecipeHelper::set_count);
ADD_PROPERTY(PropertyInfo(Variant::INT, "count"), "set_count", "get_count");
}
================================================
FILE: data/items/craft_recipe_helper.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef CRAFT_RECIPE_HELPER_H
#define CRAFT_RECIPE_HELPER_H
#include "core/version.h"
#include "core/io/resource.h"
#include "item_template.h"
class CraftRecipeHelper : public Resource {
GDCLASS(CraftRecipeHelper, Resource);
public:
Ref<ItemTemplate> get_item();
void set_item(Ref<ItemTemplate> value);
int get_count();
void set_count(int value);
CraftRecipeHelper(Ref<ItemTemplate> item, int count);
CraftRecipeHelper();
~CraftRecipeHelper();
protected:
static void _bind_methods();
private:
Ref<ItemTemplate> _item;
int _count;
};
#endif
================================================
FILE: data/items/equipment_data.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "equipment_data.h"
#include "item_instance.h"
#include "item_template.h"
#include "../../singletons/ess.h"
Ref<ItemTemplate> EquipmentData::get_slot(int index) {
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemTemplate>());
return _entries[index];
}
void EquipmentData::set_slot(int index, Ref<ItemTemplate> entry) {
ERR_FAIL_INDEX(index, ESS::get_singleton()->equip_slot_get_count());
_entries.write[index] = entry;
}
Ref<ItemInstance> EquipmentData::get_item(int index) {
ERR_FAIL_INDEX_V(index, ESS::get_singleton()->equip_slot_get_count(), Ref<ItemInstance>());
Ref<ItemTemplate> ede = _entries[index];
if (!ede.is_valid())
return Ref<ItemInstance>();
return ede->create_item_instance();
}
EquipmentData::EquipmentData() {
_entries.resize(ESS::get_singleton()->equip_slot_get_count());
}
EquipmentData::~EquipmentData() {
_entries.clear();
}
bool EquipmentData::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
if (name.get_slicec('/', 0) == "slot") {
StringName prop = name.get_slicec('/', 1);
if (ESS::get_singleton()->equip_slot_is_property(prop)) {
int id = ESS::get_singleton()->equip_slot_get_property_id(prop);
if (_entries.size() < id) {
return false;
}
_entries.set(id, p_value);
return true;
} else {
return false;
}
} else {
return false;
}
return true;
}
bool EquipmentData::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name.get_slicec('/', 0) == "slot") {
StringName prop = name.get_slicec('/', 1);
if (ESS::get_singleton()->equip_slot_is_property(prop)) {
int id = ESS::get_singleton()->equip_slot_get_property_id(prop);
if (_entries.size() < id) {
return false;
}
r_ret = _entries[id];
return true;
} else {
return false;
}
} else {
return false;
}
return true;
}
void EquipmentData::_get_property_list(List<PropertyInfo> *p_list) const {
for (int i = 0; i < ESS::get_singleton()->equip_slot_get_count(); ++i) {
p_list->push_back(PropertyInfo(Variant::OBJECT, "slot/" + ESS::get_singleton()->equip_slot_get_property_name(i), PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate"));
}
}
void EquipmentData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_slot", "index"), &EquipmentData::get_slot);
ClassDB::bind_method(D_METHOD("set_slot", "index", "entry"), &EquipmentData::set_slot);
}
================================================
FILE: data/items/equipment_data.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef EQUIPMENT_DATA_H
#define EQUIPMENT_DATA_H
#include "core/version.h"
#include "core/io/resource.h"
class ItemInstance;
class ItemTemplate;
class EquipmentData : public Resource {
GDCLASS(EquipmentData, Resource);
public:
Ref<ItemTemplate> get_slot(int index);
void set_slot(int index, Ref<ItemTemplate> entry);
Ref<ItemInstance> get_item(int index);
EquipmentData();
~EquipmentData();
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
private:
Vector<Ref<ItemTemplate> > _entries;
};
#endif
================================================
FILE: data/items/item_instance.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "item_instance.h"
#include "item_template.h"
#include "../../database/ess_resource_db.h"
#include "../../singletons/ess.h"
#include "core/version.h"
Ref<ItemTemplate> ItemInstance::get_item_template() {
return _item_template;
}
void ItemInstance::set_item_template(const Ref<ItemTemplate> &value) {
_item_template = value;
_item_template_path = "";
if (value.is_valid())
_item_template_path = value->get_path();
}
int ItemInstance::stat_modifier_get_stat_id(const int index) const {
ERR_FAIL_INDEX_V(index, _modifiers.size(), 0);
return _modifiers[index].stat_id;
}
void ItemInstance::stat_modifier_set_stat_id(const int index, const int value) {
ERR_FAIL_INDEX(index, _modifiers.size());
_modifiers.write[index].stat_id = value;
}
float ItemInstance::stat_modifier_get_base_mod(const int index) const {
ERR_FAIL_INDEX_V(index, _modifiers.size(), 0);
return _modifiers[index].base_mod;
}
void ItemInstance::stat_modifier_set_base_mod(const int index, const float value) {
ERR_FAIL_INDEX(index, _modifiers.size());
_modifiers.write[index].base_mod = value;
}
float ItemInstance::stat_modifier_get_bonus_mod(const int index) const {
ERR_FAIL_INDEX_V(index, _modifiers.size(), 0);
return _modifiers[index].bonus_mod;
}
void ItemInstance::stat_modifier_set_bonus_mod(const int index, const float value) {
ERR_FAIL_INDEX(index, _modifiers.size());
_modifiers.write[index].bonus_mod = value;
}
float ItemInstance::stat_modifier_get_percent_mod(const int index) const {
ERR_FAIL_INDEX_V(index, _modifiers.size(), 0);
return _modifiers[index].percent_mod;
}
void ItemInstance::stat_modifier_set_percent_mod(const int index, const float value) {
ERR_FAIL_INDEX(index, _modifiers.size());
_modifiers.write[index].percent_mod = value;
}
void ItemInstance::add_item_stat_modifier(const int stat_id, const int base_mod, const int bonus_mod, const int percent_mod) {
ItemStatModifier mod;
mod.stat_id = stat_id;
mod.base_mod = base_mod;
mod.bonus_mod = bonus_mod;
mod.percent_mod = percent_mod;
_modifiers.push_back(mod);
}
void ItemInstance::remove_item_stat_modifier(const int index) {
ERR_FAIL_INDEX(index, _modifiers.size());
_modifiers.remove_at(index);
}
void ItemInstance::clear_item_stat_modifiers() {
_modifiers.clear();
}
int ItemInstance::stat_modifier_get_count() const {
return _modifiers.size();
}
Vector<Variant> ItemInstance::stat_modifiers_get() {
Vector<Variant> arr;
arr.resize(_modifiers.size() * 4);
for (int i = 0; i < _modifiers.size(); ++i) {
int indx = i * 4;
const ItemStatModifier &m = _modifiers[i];
arr.write[indx] = m.stat_id;
arr.write[indx + 1] = m.base_mod;
arr.write[indx + 2] = m.bonus_mod;
arr.write[indx + 3] = m.percent_mod;
}
return arr;
}
void ItemInstance::stat_modifiers_set(const Vector<Variant> &mods) {
ERR_FAIL_COND((mods.size() % 4) != 0);
_modifiers.resize(mods.size() / 4);
for (int i = 0; i < _modifiers.size(); ++i) {
int indx = i * 4;
ItemStatModifier &m = _modifiers.write[i];
m.stat_id = mods[indx];
m.base_mod = mods[indx + 1];
m.bonus_mod = mods[indx + 2];
m.percent_mod = mods[indx + 3];
}
}
int ItemInstance::get_stack_size() const {
return _stack_size;
}
void ItemInstance::set_stack_size(const int value) {
_stack_size = value;
emit_signal("stack_size_changed", Ref<ItemInstance>(this));
}
int ItemInstance::get_charges() const {
return _charges;
}
void ItemInstance::set_charges(const int value) {
_charges = value;
emit_signal("stack_charges_changed", Ref<ItemInstance>(this));
}
String ItemInstance::get_description() {
if (!has_method("_get_description"))
return "";
return call("_get_description");
}
Dictionary ItemInstance::to_dict() {
return call("_to_dict");
}
void ItemInstance::from_dict(const Dictionary &dict) {
call("_from_dict", dict);
}
Dictionary ItemInstance::_to_dict() {
Dictionary dict;
dict["item_path"] = _item_template->get_path();
dict["stack_size"] = _stack_size;
Array mods;
for (int i = 0; i < _modifiers.size(); ++i) {
Dictionary mdict;
mdict["stat_id"] = _modifiers[i].stat_id;
mdict["base_mod"] = _modifiers[i].base_mod;
mdict["bonus_mod"] = _modifiers[i].bonus_mod;
mdict["percent_mod"] = _modifiers[i].percent_mod;
mods.append(mdict);
}
dict["modifiers"] = mods;
return dict;
}
void ItemInstance::_from_dict(const Dictionary &dict) {
ERR_FAIL_COND(dict.is_empty());
_item_template_path = dict.get("item_path", 0);
if (ESS::get_singleton() != NULL) {
_item_template = ESS::get_singleton()->get_resource_db()->get_item_template_path(_item_template_path);
}
_stack_size = dict.get("stack_size", 0);
Array mods = dict.get("modifiers", Array());
for (int i = 0; i < mods.size(); ++i) {
ItemStatModifier mod;
Dictionary mdict = mods.get(i);
mod.stat_id = dict.get("stat_id", 0);
mod.base_mod = dict.get("base_mod", 0);
mod.bonus_mod = dict.get("bonus_mod", 0);
mod.percent_mod = dict.get("percent_mod", 0);
_modifiers.push_back(mod);
}
}
ItemInstance::ItemInstance() {
_stack_size = 1;
_charges = -1;
}
ItemInstance::~ItemInstance() {
_modifiers.clear();
}
void ItemInstance::_bind_methods() {
ADD_SIGNAL(MethodInfo("stack_size_changed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance")));
ADD_SIGNAL(MethodInfo("stack_charges_changed", PropertyInfo(Variant::OBJECT, "item", PROPERTY_HINT_RESOURCE_TYPE, "ItemInstance")));
ClassDB::bind_method(D_METHOD("get_item_template"), &ItemInstance::get_item_template);
ClassDB::bind_method(D_METHOD("set_item_template", "value"), &ItemInstance::set_item_template);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "item_template", PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate"), "set_item_template", "get_item_template");
ClassDB::bind_method(D_METHOD("get_stack_size"), &ItemInstance::get_stack_size);
ClassDB::bind_method(D_METHOD("set_stack_size", "count"), &ItemInstance::set_stack_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "stack_size"), "set_stack_size", "get_stack_size");
ClassDB::bind_method(D_METHOD("get_charges"), &ItemInstance::get_charges);
ClassDB::bind_method(D_METHOD("set_charges", "size"), &ItemInstance::set_charges);
ADD_PROPERTY(PropertyInfo(Variant::INT, "charges"), "set_charges", "get_charges");
ClassDB::bind_method(D_METHOD("stat_modifier_get_stat_id", "index"), &ItemInstance::stat_modifier_get_stat_id);
ClassDB::bind_method(D_METHOD("stat_modifier_set_stat_id", "index", "value"), &ItemInstance::stat_modifier_set_stat_id);
ClassDB::bind_method(D_METHOD("stat_modifier_get_base_mod", "index"), &ItemInstance::stat_modifier_get_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_base_mod", "index", "value"), &ItemInstance::stat_modifier_set_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_bonus_mod", "index"), &ItemInstance::stat_modifier_get_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_bonus_mod", "index", "value"), &ItemInstance::stat_modifier_set_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_percent_mod", "index"), &ItemInstance::stat_modifier_get_percent_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_percent_mod", "index", "value"), &ItemInstance::stat_modifier_set_percent_mod);
ClassDB::bind_method(D_METHOD("add_item_stat_modifier", "stat_id", "base_mod", "bonus_mod", "percent_mod"), &ItemInstance::add_item_stat_modifier);
ClassDB::bind_method(D_METHOD("remove_item_stat_modifier", "index"), &ItemInstance::remove_item_stat_modifier);
ClassDB::bind_method(D_METHOD("clear_item_stat_modifiers"), &ItemInstance::clear_item_stat_modifiers);
ClassDB::bind_method(D_METHOD("stat_modifier_get_count"), &ItemInstance::stat_modifier_get_count);
ClassDB::bind_method(D_METHOD("stat_modifiers_get"), &ItemInstance::stat_modifiers_get);
ClassDB::bind_method(D_METHOD("stat_modifiers_set", "mods"), &ItemInstance::stat_modifiers_set);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "stat_modifiers", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT, ""), "stat_modifiers_set", "stat_modifiers_get");
////GDVIRTUAL_BIND("_get_description", "desc");
ClassDB::bind_method(D_METHOD("get_description"), &ItemInstance::get_description);
//Serialization
////GDVIRTUAL_BIND("_from_dict", "dict");
////GDVIRTUAL_BIND("_to_dict", "dict");
ClassDB::bind_method(D_METHOD("from_dict", "dict"), &ItemInstance::from_dict);
ClassDB::bind_method(D_METHOD("to_dict"), &ItemInstance::to_dict);
ClassDB::bind_method(D_METHOD("_from_dict", "dict"), &ItemInstance::_from_dict);
ClassDB::bind_method(D_METHOD("_to_dict"), &ItemInstance::_to_dict);
}
================================================
FILE: data/items/item_instance.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef ITEM_INSTANCE_H
#define ITEM_INSTANCE_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/templates/vector.h"
#include "../../item_enums.h"
class ItemTemplate;
class ItemInstance : public Resource {
GDCLASS(ItemInstance, Resource);
public:
Ref<ItemTemplate> get_item_template();
void set_item_template(const Ref<ItemTemplate> &value);
//Modifiers
int stat_modifier_get_stat_id(const int index) const;
void stat_modifier_set_stat_id(const int index, const int value);
float stat_modifier_get_base_mod(const int index) const;
void stat_modifier_set_base_mod(const int index, const float value);
float stat_modifier_get_bonus_mod(const int index) const;
void stat_modifier_set_bonus_mod(const int index, const float value);
float stat_modifier_get_percent_mod(const int index) const;
void stat_modifier_set_percent_mod(const int index, const float value);
void add_item_stat_modifier(const int stat_id, const int base_mod, const int bonus_mod, const int percent_mod);
void remove_item_stat_modifier(const int index);
void clear_item_stat_modifiers();
int stat_modifier_get_count() const;
Vector<Variant> stat_modifiers_get();
void stat_modifiers_set(const Vector<Variant> &mods);
int get_stack_size() const;
void set_stack_size(const int value);
int get_charges() const;
void set_charges(const int value);
String get_description();
Dictionary to_dict();
void from_dict(const Dictionary &dict);
virtual Dictionary _to_dict();
virtual void _from_dict(const Dictionary &dict);
ItemInstance();
~ItemInstance();
protected:
static void _bind_methods();
protected:
struct ItemStatModifier {
int stat_id;
float base_mod;
float bonus_mod;
float percent_mod;
ItemStatModifier() {
stat_id = 0;
base_mod = 0;
bonus_mod = 0;
percent_mod = 0;
}
};
private:
Ref<ItemTemplate> _item_template;
StringName _item_template_path;
int _stack_size;
int _charges;
Vector<ItemStatModifier> _modifiers;
};
#endif
================================================
FILE: data/items/item_template.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "item_template.h"
#include "../../entities/data/entity_class_data.h"
#include "../spells/spell.h"
#include "item_instance.h"
#include "../../singletons/ess.h"
#include "../../defines.h"
int ItemTemplate::get_id() const {
return _id;
}
void ItemTemplate::set_id(const int value) {
_id = value;
}
ItemEnums::ItemType ItemTemplate::get_item_type() const {
return _item_type;
}
void ItemTemplate::set_item_type(const ItemEnums::ItemType value) {
_item_type = value;
}
ItemEnums::ItemSubtype ItemTemplate::get_item_sub_type() const {
return _item_sub_type;
}
void ItemTemplate::set_item_sub_type(const ItemEnums::ItemSubtype value) {
_item_sub_type = value;
}
ItemEnums::ItemSubSubtype ItemTemplate::get_item_sub_sub_type() const {
return _item_sub_sub_type;
}
void ItemTemplate::set_item_sub_sub_type(const ItemEnums::ItemSubSubtype value) {
_item_sub_sub_type = value;
}
ItemEnums::ItemRarity ItemTemplate::get_rarity() const {
return _rarity;
}
void ItemTemplate::set_rarity(const ItemEnums::ItemRarity value) {
_rarity = value;
}
ItemEnums::ArmorType ItemTemplate::get_armor_type() const {
return _armor_type;
}
void ItemTemplate::set_armor_type(const ItemEnums::ArmorType value) {
_armor_type = value;
}
int ItemTemplate::get_equip_slot() const {
return _equip_slot;
}
void ItemTemplate::set_equip_slot(const int value) {
_equip_slot = value;
}
Ref<ModelVisual> ItemTemplate::get_model_visual() const {
return _model_visual;
}
void ItemTemplate::set_model_visual(const Ref<ModelVisual> &value) {
_model_visual = value;
}
Ref<EntityClassData> ItemTemplate::get_required_character_class() const {
return _required_character_class;
}
void ItemTemplate::set_required_character_class(const Ref<EntityClassData> &value) {
_required_character_class = value;
}
int ItemTemplate::get_price() const {
return _price;
}
void ItemTemplate::set_price(const int value) {
_price = value;
}
int ItemTemplate::get_stack_size() const {
return _stack_size;
}
void ItemTemplate::set_stack_size(const int value) {
_stack_size = value;
}
Ref<Texture> ItemTemplate::get_icon() const {
return _icon;
}
void ItemTemplate::set_icon(const Ref<Texture> &value) {
_icon = value;
}
float ItemTemplate::get_scale_x() const {
return _scale_x;
}
void ItemTemplate::set_scale_x(const float value) {
_scale_x = value;
}
float ItemTemplate::get_scale_y() const {
return _scale_y;
}
void ItemTemplate::set_scale_y(const float value) {
_scale_y = value;
}
float ItemTemplate::get_scale_z() const {
return _scale_z;
}
void ItemTemplate::set_scale_z(const float value) {
_scale_z = value;
}
int ItemTemplate::get_bag_size() const {
return _bag_size;
}
void ItemTemplate::set_bag_size(const int size) {
_bag_size = size;
}
/// TEXTS ////
String ItemTemplate::get_text_translation_key() const {
return _text_translation_key;
}
void ItemTemplate::set_text_translation_key(const String &value) {
_text_translation_key = value;
}
//// TEACHES ////
int ItemTemplate::get_num_teaches_spells() const {
return _teaches_spells.size();
}
void ItemTemplate::set_num_teaches_spells(int value) {
_teaches_spells.resize(value);
}
Ref<Spell> ItemTemplate::get_teaches_spell(const int index) {
ERR_FAIL_INDEX_V(index, _teaches_spells.size(), Ref<Spell>());
return _teaches_spells[index];
}
void ItemTemplate::set_teaches_spell(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _teaches_spells.size());
_teaches_spells.set(index, Ref<Spell>(spell));
}
Vector<Variant> ItemTemplate::get_teaches_spells() {
VARIANT_ARRAY_GET(_teaches_spells);
}
void ItemTemplate::set_teaches_spells(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _teaches_spells, Spell);
}
//// GRANTS SPELLS ////
int ItemTemplate::get_num_grants_spells() const {
return _grants_spells.size();
}
void ItemTemplate::set_num_grants_spells(const int value) {
_grants_spells.resize(value);
}
Ref<Spell> ItemTemplate::get_grants_spell(const int index) {
ERR_FAIL_INDEX_V(index, _grants_spells.size(), Ref<Spell>());
return _grants_spells[index];
}
void ItemTemplate::set_grants_spell(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _grants_spells.size());
_grants_spells.set(index, Ref<Spell>(spell));
}
Vector<Variant> ItemTemplate::get_grants_spells() {
VARIANT_ARRAY_GET(_grants_spells);
}
void ItemTemplate::set_grants_spells(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _grants_spells, Spell);
}
//// AURAS ////
int ItemTemplate::get_num_auras() const {
return _auras.size();
}
void ItemTemplate::set_num_auras(int value) {
_auras.resize(value);
}
Ref<Spell> ItemTemplate::get_aura(const int index) {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Spell>());
return _auras[index];
}
void ItemTemplate::set_aura(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.set(index, Ref<Spell>(aura));
}
Vector<Variant> ItemTemplate::get_auras() {
VARIANT_ARRAY_GET(_auras);
}
void ItemTemplate::set_auras(const Vector<Variant> &auras) {
VARIANT_ARRAY_SET(auras, _auras, Spell);
}
//Required Skills
int ItemTemplate::get_num_required_skills() const {
return _required_skills.size();
}
Ref<Spell> ItemTemplate::get_required_skill(const int index) {
ERR_FAIL_INDEX_V(index, _required_skills.size(), Ref<Spell>());
return _required_skills.get(index);
}
void ItemTemplate::set_required_skill(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _required_skills.size());
_required_skills.set(index, aura);
}
Vector<Variant> ItemTemplate::get_required_skills() {
VARIANT_ARRAY_GET(_required_skills);
}
void ItemTemplate::set_required_skills(const Vector<Variant> &skills) {
VARIANT_ARRAY_SET(skills, _required_skills, Spell);
}
//use spell
Ref<Spell> ItemTemplate::get_use_spell() {
return _use_spell;
}
void ItemTemplate::set_use_spell(const Ref<Spell> &use_spell) {
_use_spell = use_spell;
}
int ItemTemplate::get_charges() const {
return _charges;
}
void ItemTemplate::set_charges(const int value) {
_charges = value;
}
bool ItemTemplate::get_consumed() const {
return _consumed;
}
void ItemTemplate::set_consumed(const bool value) {
_consumed = false;
}
int ItemTemplate::stat_modifier_get_count() const {
return _modifier_count;
}
void ItemTemplate::stat_modifier_set_count(int value) {
_modifier_count = value;
}
int ItemTemplate::stat_modifier_get_stat_id(const int index) const {
return _modifiers[index].stat_id;
}
void ItemTemplate::stat_modifier_set_stat_id(const int index, const int value) {
_modifiers[index].stat_id = value;
}
float ItemTemplate::stat_modifier_get_min_base_mod(const int index) const {
return _modifiers[index].min_base_mod;
}
void ItemTemplate::stat_modifier_set_min_base_mod(const int index, const float value) {
_modifiers[index].min_base_mod = value;
}
float ItemTemplate::stat_modifier_get_max_base_mod(const int index) const {
return _modifiers[index].max_base_mod;
}
void ItemTemplate::stat_modifier_set_max_base_mod(const int index, const float value) {
_modifiers[index].max_base_mod = value;
}
float ItemTemplate::stat_modifier_get_min_bonus_mod(const int index) const {
return _modifiers[index].min_bonus_mod;
}
void ItemTemplate::stat_modifier_set_min_bonus_mod(const int index, const float value) {
_modifiers[index].min_bonus_mod = value;
}
float ItemTemplate::stat_modifier_get_max_bonus_mod(const int index) const {
return _modifiers[index].max_bonus_mod;
}
void ItemTemplate::stat_modifier_set_max_bonus_mod(const int index, const float value) {
_modifiers[index].max_bonus_mod = value;
}
float ItemTemplate::stat_modifier_get_min_percent_mod(const int index) const {
return _modifiers[index].min_percent_mod;
}
void ItemTemplate::stat_modifier_set_min_percent_mod(const int index, const float value) {
_modifiers[index].min_percent_mod = value;
}
float ItemTemplate::stat_modifier_get_max_percent_mod(const int index) const {
return _modifiers[index].max_percent_mod;
}
void ItemTemplate::stat_modifier_set_max_percent_mod(const int index, const float value) {
_modifiers[index].max_percent_mod = value;
}
float ItemTemplate::stat_modifier_get_scaling_factor(const int index) const {
return _modifiers[index].scaling_factor;
}
void ItemTemplate::stat_modifier_set_scaling_factor(const int index, const float value) {
_modifiers[index].scaling_factor = value;
}
int ItemTemplate::get_animator_weapon_type() {
if (_item_sub_type == ItemEnums::ITEM_SUB_TYPE_SWORD) {
return 1;
}
if (_item_sub_type == ItemEnums::ITEM_SUB_TYPE_BOW) {
return 2;
}
if (_item_sub_type == ItemEnums::ITEM_SUB_TYPE_AXE) {
return 3;
}
return 0;
}
Ref<ItemInstance> ItemTemplate::create_item_instance() {
if (has_method("_create_item_instance")) {
Ref<ItemInstance> ii = call("_create_item_instance");
ERR_FAIL_COND_V(!ii.is_valid(), Ref<ItemInstance>());
return ii;
}
Ref<ItemInstance> item;
item.instantiate();
//todo setup
//ERR_EXPLAIN("NOT YET IMPLEMENTED!");
ERR_FAIL_V(item);
return item;
}
String ItemTemplate::get_description() {
if (!has_method("_get_description"))
return "";
return call("_get_description");
}
ItemTemplate::ItemTemplate() {
_id = 0;
_item_type = ItemEnums::ITEM_TYPE_NONE;
_item_sub_type = ItemEnums::ITEM_SUB_TYPE_NONE;
_item_sub_sub_type = ItemEnums::ITEM_SUB_SUB_TYPE_NONE;
_rarity = ItemEnums::ITEM_RARITY_NONE;
_armor_type = ItemEnums::ARMOR_TYPE_NONE;
_equip_slot = ESS::get_singleton()->equip_slot_get_count();
_price = 0;
_scale_x = 0;
_scale_y = 0;
_scale_z = 0;
_modifier_count = 0;
_stack_size = 1;
_bag_size = 0;
_charges = -1;
_consumed = false;
}
ItemTemplate::~ItemTemplate() {
_teaches_spells.clear();
_grants_spells.clear();
_auras.clear();
_required_character_class.unref();
}
void ItemTemplate::_validate_property(PropertyInfo &property) const {
String prop = property.name;
if (prop.begins_with("stat_modifier_")) {
if (prop.ends_with("count"))
return;
int frame = prop.get_slicec('/', 0).get_slicec('_', 2).to_int();
if (frame >= _modifier_count) {
property.usage = 0;
}
if (property.name.ends_with("stat_id"))
property.hint_string = ESS::get_singleton()->stat_get_string();
} else if (prop == "equip_slot") {
property.hint_string = ESS::get_singleton()->equip_slot_get_string();
}
}
void ItemTemplate::_bind_methods() {
////GDVIRTUAL_BIND("_create_item_instance");
ClassDB::bind_method(D_METHOD("create_item_instance"), &ItemTemplate::create_item_instance);
ClassDB::bind_method(D_METHOD("get_id"), &ItemTemplate::get_id);
ClassDB::bind_method(D_METHOD("set_id", "count"), &ItemTemplate::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ClassDB::bind_method(D_METHOD("get_item_type"), &ItemTemplate::get_item_type);
ClassDB::bind_method(D_METHOD("set_item_type", "count"), &ItemTemplate::set_item_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "item_type", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_ITEM_TYPE), "set_item_type", "get_item_type");
ClassDB::bind_method(D_METHOD("get_item_sub_type"), &ItemTemplate::get_item_sub_type);
ClassDB::bind_method(D_METHOD("set_item_sub_type", "count"), &ItemTemplate::set_item_sub_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "item_sub_type", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_ITEM_SUB_TYPE), "set_item_sub_type", "get_item_sub_type");
ClassDB::bind_method(D_METHOD("get_item_sub_sub_type"), &ItemTemplate::get_item_sub_sub_type);
ClassDB::bind_method(D_METHOD("set_item_sub_sub_type", "count"), &ItemTemplate::set_item_sub_sub_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "item_sub_sub_type", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_ITEM_SUB_SUB_TYPE), "set_item_sub_sub_type", "get_item_sub_sub_type");
ClassDB::bind_method(D_METHOD("get_rarity"), &ItemTemplate::get_rarity);
ClassDB::bind_method(D_METHOD("set_rarity", "count"), &ItemTemplate::set_rarity);
ADD_PROPERTY(PropertyInfo(Variant::INT, "rarity", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_RARITY), "set_rarity", "get_rarity");
ClassDB::bind_method(D_METHOD("get_armor_type"), &ItemTemplate::get_armor_type);
ClassDB::bind_method(D_METHOD("set_armor_type", "value"), &ItemTemplate::set_armor_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "armor_type", PROPERTY_HINT_ENUM, ItemEnums::BINDING_STRING_ARMOR_TYPE), "set_armor_type", "get_armor_type");
ClassDB::bind_method(D_METHOD("get_equip_slot"), &ItemTemplate::get_equip_slot);
ClassDB::bind_method(D_METHOD("set_equip_slot", "count"), &ItemTemplate::set_equip_slot);
ADD_PROPERTY(PropertyInfo(Variant::INT, "equip_slot", PROPERTY_HINT_ENUM, ""), "set_equip_slot", "get_equip_slot");
ClassDB::bind_method(D_METHOD("get_price"), &ItemTemplate::get_price);
ClassDB::bind_method(D_METHOD("set_price", "count"), &ItemTemplate::set_price);
ADD_PROPERTY(PropertyInfo(Variant::INT, "price"), "set_price", "get_price");
ClassDB::bind_method(D_METHOD("get_model_visual"), &ItemTemplate::get_model_visual);
ClassDB::bind_method(D_METHOD("set_model_visual", "value"), &ItemTemplate::set_model_visual);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "model_visual", PROPERTY_HINT_RESOURCE_TYPE, "ModelVisual"), "set_model_visual", "get_model_visual");
ClassDB::bind_method(D_METHOD("get_stack_size"), &ItemTemplate::get_stack_size);
ClassDB::bind_method(D_METHOD("set_stack_size", "value"), &ItemTemplate::set_stack_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "stack_size"), "set_stack_size", "get_stack_size");
ClassDB::bind_method(D_METHOD("get_icon"), &ItemTemplate::get_icon);
ClassDB::bind_method(D_METHOD("set_icon", "value"), &ItemTemplate::set_icon);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "icon", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_icon", "get_icon");
ClassDB::bind_method(D_METHOD("get_scale_x"), &ItemTemplate::get_scale_x);
ClassDB::bind_method(D_METHOD("set_scale_x", "count"), &ItemTemplate::set_scale_x);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_x"), "set_scale_x", "get_scale_x");
ClassDB::bind_method(D_METHOD("get_scale_y"), &ItemTemplate::get_scale_y);
ClassDB::bind_method(D_METHOD("set_scale_y", "count"), &ItemTemplate::set_scale_y);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_y"), "set_scale_y", "get_scale_y");
ClassDB::bind_method(D_METHOD("get_scale_z"), &ItemTemplate::get_scale_z);
ClassDB::bind_method(D_METHOD("set_scale_z", "count"), &ItemTemplate::set_scale_z);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "scale_z"), "set_scale_z", "get_scale_z");
ClassDB::bind_method(D_METHOD("get_bag_size"), &ItemTemplate::get_bag_size);
ClassDB::bind_method(D_METHOD("set_bag_size", "size"), &ItemTemplate::set_bag_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "bag_size"), "set_bag_size", "get_bag_size");
//// Teaches ////
ClassDB::bind_method(D_METHOD("get_num_teaches_spells"), &ItemTemplate::get_num_teaches_spells);
ClassDB::bind_method(D_METHOD("set_num_teaches_spells", "value"), &ItemTemplate::set_num_teaches_spells);
ClassDB::bind_method(D_METHOD("get_teaches_spell", "index"), &ItemTemplate::get_teaches_spell);
ClassDB::bind_method(D_METHOD("set_teaches_spell", "index", "spell"), &ItemTemplate::set_teaches_spell);
ClassDB::bind_method(D_METHOD("get_teaches_spells"), &ItemTemplate::get_teaches_spells);
ClassDB::bind_method(D_METHOD("set_teaches_spells", "spells"), &ItemTemplate::set_teaches_spells);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "teaches_spells", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_teaches_spells", "get_teaches_spells");
//// Grants Spells ////
ClassDB::bind_method(D_METHOD("get_num_grants_spells"), &ItemTemplate::get_num_grants_spells);
ClassDB::bind_method(D_METHOD("set_num_grants_spells", "value"), &ItemTemplate::set_num_grants_spells);
ClassDB::bind_method(D_METHOD("get_grants_spell", "index"), &ItemTemplate::get_grants_spell);
ClassDB::bind_method(D_METHOD("set_grants_spell", "index", "spell"), &ItemTemplate::set_grants_spell);
ClassDB::bind_method(D_METHOD("get_grants_spells"), &ItemTemplate::get_grants_spells);
ClassDB::bind_method(D_METHOD("set_grants_spells", "spells"), &ItemTemplate::set_grants_spells);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "grants_spells", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_grants_spells", "get_grants_spells");
//// Auras ////
ClassDB::bind_method(D_METHOD("get_num_auras"), &ItemTemplate::get_num_auras);
ClassDB::bind_method(D_METHOD("set_num_auras", "value"), &ItemTemplate::set_num_auras);
ClassDB::bind_method(D_METHOD("get_aura", "index"), &ItemTemplate::get_aura);
ClassDB::bind_method(D_METHOD("set_aura", "index", "aura"), &ItemTemplate::set_aura);
ClassDB::bind_method(D_METHOD("get_auras"), &ItemTemplate::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "auras"), &ItemTemplate::set_auras);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras");
//// Required Skills ////
ClassDB::bind_method(D_METHOD("get_num_required_skills"), &ItemTemplate::get_num_required_skills);
ClassDB::bind_method(D_METHOD("get_required_skill", "index"), &ItemTemplate::get_required_skill);
ClassDB::bind_method(D_METHOD("set_required_skill", "index", "aura"), &ItemTemplate::set_required_skill);
ClassDB::bind_method(D_METHOD("get_required_skills"), &ItemTemplate::get_required_skills);
ClassDB::bind_method(D_METHOD("set_required_skills", "auras"), &ItemTemplate::set_required_skills);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "required_skills", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_required_skills", "get_required_skills");
//Use spell
ClassDB::bind_method(D_METHOD("get_use_spell"), &ItemTemplate::get_use_spell);
ClassDB::bind_method(D_METHOD("set_use_spell", "size"), &ItemTemplate::set_use_spell);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "use_spell", PROPERTY_HINT_RESOURCE_TYPE, "Spell"), "set_use_spell", "get_use_spell");
ClassDB::bind_method(D_METHOD("get_charges"), &ItemTemplate::get_charges);
ClassDB::bind_method(D_METHOD("set_charges", "size"), &ItemTemplate::set_charges);
ADD_PROPERTY(PropertyInfo(Variant::INT, "charges"), "set_charges", "get_charges");
ClassDB::bind_method(D_METHOD("get_consumed"), &ItemTemplate::get_consumed);
ClassDB::bind_method(D_METHOD("set_consumed", "size"), &ItemTemplate::set_consumed);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "consumed"), "set_consumed", "get_consumed");
ADD_GROUP("Texts", "text");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
ClassDB::bind_method(D_METHOD("get_text_translation_key"), &ItemTemplate::get_text_translation_key);
ClassDB::bind_method(D_METHOD("set_text_translation_key", "value"), &ItemTemplate::set_text_translation_key);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_translation_key"), "set_text_translation_key", "get_text_translation_key");
////GDVIRTUAL_BIND("_get_description");
ClassDB::bind_method(D_METHOD("get_description"), &ItemTemplate::get_description);
//StatMods Property binds
ADD_GROUP("Stat Modifiers", "stat_modifier");
ClassDB::bind_method(D_METHOD("stat_modifier_get_count"), &ItemTemplate::stat_modifier_get_count);
ClassDB::bind_method(D_METHOD("stat_modifier_set_count", "count"), &ItemTemplate::stat_modifier_set_count);
ADD_PROPERTY(PropertyInfo(Variant::INT, "stat_modifier_count", PROPERTY_HINT_RANGE, "0," + itos(MAX_ITEM_STAT_MOD), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "stat_modifier_set_count", "stat_modifier_get_count");
ClassDB::bind_method(D_METHOD("stat_modifier_get_stat_id", "index"), &ItemTemplate::stat_modifier_get_stat_id);
ClassDB::bind_method(D_METHOD("stat_modifier_set_stat_id", "index", "value"), &ItemTemplate::stat_modifier_set_stat_id);
ClassDB::bind_method(D_METHOD("stat_modifier_get_min_base_mod", "index"), &ItemTemplate::stat_modifier_get_min_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_min_base_mod", "index", "value"), &ItemTemplate::stat_modifier_set_min_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_max_base_mod", "index"), &ItemTemplate::stat_modifier_get_max_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_max_base_mod", "index", "value"), &ItemTemplate::stat_modifier_set_max_base_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_min_bonus_mod", "index"), &ItemTemplate::stat_modifier_get_min_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_min_bonus_mod", "index", "value"), &ItemTemplate::stat_modifier_set_min_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_max_bonus_mod", "index"), &ItemTemplate::stat_modifier_get_max_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_max_bonus_mod", "index", "value"), &ItemTemplate::stat_modifier_set_max_bonus_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_min_percent_mod", "index"), &ItemTemplate::stat_modifier_get_min_percent_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_min_percent_mod", "index", "value"), &ItemTemplate::stat_modifier_set_min_percent_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_max_percent_mod", "index"), &ItemTemplate::stat_modifier_get_max_percent_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_set_max_percent_mod", "index", "value"), &ItemTemplate::stat_modifier_set_max_percent_mod);
ClassDB::bind_method(D_METHOD("stat_modifier_get_scaling_factor", "index"), &ItemTemplate::stat_modifier_get_scaling_factor);
ClassDB::bind_method(D_METHOD("stat_modifier_set_scaling_factor", "index", "value"), &ItemTemplate::stat_modifier_set_scaling_factor);
for (int i = 0; i < MAX_ITEM_STAT_MOD; ++i) {
ADD_PROPERTYI(PropertyInfo(Variant::INT, "stat_modifier_" + itos(i) + "/stat_id", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_stat_id", "stat_modifier_get_stat_id", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/min_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_min_base_mod", "stat_modifier_get_min_base_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/max_base_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_max_base_mod", "stat_modifier_get_max_base_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/min_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_min_bonus_mod", "stat_modifier_get_min_bonus_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/max_bonus_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_max_bonus_mod", "stat_modifier_get_max_bonus_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/min_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_min_percent_mod", "stat_modifier_get_min_percent_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/max_percent_mod", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_max_percent_mod", "stat_modifier_get_max_percent_mod", i);
ADD_PROPERTYI(PropertyInfo(Variant::REAL, "stat_modifier_" + itos(i) + "/scaling_factor", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL), "stat_modifier_set_scaling_factor", "stat_modifier_get_scaling_factor", i);
}
ClassDB::bind_method(D_METHOD("get_animator_weapon_type"), &ItemTemplate::get_animator_weapon_type);
BIND_CONSTANT(MAX_ITEM_STAT_MOD);
}
================================================
FILE: data/items/item_template.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef ITEM_TEMPLATE_H
#define ITEM_TEMPLATE_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/templates/vector.h"
#include "scene/resources/texture.h"
#include "../../item_enums.h"
#include "model_visual.h"
class ItemInstance;
class Spell;
class EntityClassData;
class ItemTemplate : public Resource {
GDCLASS(ItemTemplate, Resource);
public:
int get_id() const;
void set_id(const int value);
ItemEnums::ItemType get_item_type() const;
void set_item_type(const ItemEnums::ItemType value);
ItemEnums::ItemSubtype get_item_sub_type() const;
void set_item_sub_type(const ItemEnums::ItemSubtype value);
ItemEnums::ItemSubSubtype get_item_sub_sub_type() const;
void set_item_sub_sub_type(const ItemEnums::ItemSubSubtype value);
ItemEnums::ItemRarity get_rarity() const;
void set_rarity(const ItemEnums::ItemRarity value);
ItemEnums::ArmorType get_armor_type() const;
void set_armor_type(const ItemEnums::ArmorType value);
int get_equip_slot() const;
void set_equip_slot(const int value);
Ref<ModelVisual> get_model_visual() const;
void set_model_visual(const Ref<ModelVisual> &value);
Ref<EntityClassData> get_required_character_class() const;
void set_required_character_class(const Ref<EntityClassData> &value);
int get_price() const;
void set_price(const int value);
int get_stack_size() const;
void set_stack_size(const int value);
Ref<Texture> get_icon() const;
void set_icon(const Ref<Texture> &value);
float get_scale_x() const;
void set_scale_x(const float value);
float get_scale_y() const;
void set_scale_y(const float value);
float get_scale_z() const;
void set_scale_z(const float value);
int get_bag_size() const;
void set_bag_size(const int size);
String get_text_translation_key() const;
void set_text_translation_key(const String &value);
//Teaches
int get_num_teaches_spells() const;
void set_num_teaches_spells(const int value);
Ref<Spell> get_teaches_spell(const int index);
void set_teaches_spell(const int index, const Ref<Spell> &teaches_spell);
Vector<Variant> get_teaches_spells();
void set_teaches_spells(const Vector<Variant> &teaches_spells);
//Grants Spells
int get_num_grants_spells() const;
void set_num_grants_spells(const int value);
Ref<Spell> get_grants_spell(const int index);
void set_grants_spell(const int index, const Ref<Spell> &grants_spell);
Vector<Variant> get_grants_spells();
void set_grants_spells(const Vector<Variant> &grants_spells);
//Auras
int get_num_auras() const;
void set_num_auras(const int value);
Ref<Spell> get_aura(const int index);
void set_aura(const int index, const Ref<Spell> &aura);
Vector<Variant> get_auras();
void set_auras(const Vector<Variant> &auras);
//Required Skills
int get_num_required_skills() const;
Ref<Spell> get_required_skill(const int index);
void set_required_skill(const int index, const Ref<Spell> &skills);
Vector<Variant> get_required_skills();
void set_required_skills(const Vector<Variant> &grants_spells);
//use spell
Ref<Spell> get_use_spell();
void set_use_spell(const Ref<Spell> &use_spell);
int get_charges() const;
void set_charges(const int value);
bool get_consumed() const;
void set_consumed(const bool value);
//Stat mods
int stat_modifier_get_count() const;
void stat_modifier_set_count(const int value);
int stat_modifier_get_stat_id(int index) const;
void stat_modifier_set_stat_id(int index, int value);
float stat_modifier_get_min_base_mod(const int index) const;
void stat_modifier_set_min_base_mod(const int index, const float value);
float stat_modifier_get_max_base_mod(const int index) const;
void stat_modifier_set_max_base_mod(const int index, const float value);
float stat_modifier_get_min_bonus_mod(const int index) const;
void stat_modifier_set_min_bonus_mod(const int index, const float value);
float stat_modifier_get_max_bonus_mod(const int index) const;
void stat_modifier_set_max_bonus_mod(const int index, const float value);
float stat_modifier_get_min_percent_mod(const int index) const;
void stat_modifier_set_min_percent_mod(const int index, const float value);
float stat_modifier_get_max_percent_mod(const int index) const;
void stat_modifier_set_max_percent_mod(const int index, const float value);
float stat_modifier_get_scaling_factor(const int index) const;
void stat_modifier_set_scaling_factor(const int index, const float value);
int get_animator_weapon_type();
Ref<ItemInstance> create_item_instance();
String get_description();
ItemTemplate();
~ItemTemplate();
public:
struct SkillEntry {
Ref<Spell> aura;
int level;
};
protected:
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
protected:
struct ItemTemplateStatModifier {
int stat_id;
float min_base_mod;
float max_base_mod;
float min_bonus_mod;
float max_bonus_mod;
float min_percent_mod;
float max_percent_mod;
float scaling_factor;
ItemTemplateStatModifier() {
stat_id = 0;
min_base_mod = 0;
max_base_mod = 0;
min_bonus_mod = 0;
max_bonus_mod = 0;
min_percent_mod = 0;
max_percent_mod = 0;
scaling_factor = 1;
}
};
private:
enum {
MAX_ITEM_STAT_MOD = 6,
};
int _id;
ItemEnums::ItemRarity _rarity;
ItemEnums::ItemType _item_type;
ItemEnums::ItemSubtype _item_sub_type;
ItemEnums::ItemSubSubtype _item_sub_sub_type;
ItemEnums::ArmorType _armor_type;
int _equip_slot;
int _price;
Ref<EntityClassData> _required_character_class;
Ref<ModelVisual> _model_visual;
int _stack_size;
Ref<Texture> _icon;
float _scale_x;
float _scale_y;
float _scale_z;
int _bag_size;
String _text_translation_key;
Vector<Ref<Spell> > _teaches_spells;
Vector<Ref<Spell> > _grants_spells;
Vector<Ref<Spell> > _auras;
Vector<Ref<Spell> > _required_skills;
Ref<Spell> _use_spell;
int _charges;
bool _consumed;
int _modifier_count;
ItemTemplateStatModifier _modifiers[MAX_ITEM_STAT_MOD];
};
#endif
================================================
FILE: data/items/model_visual.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "model_visual.h"
#include "../../singletons/ess.h"
#include "../../defines.h"
int ModelVisual::get_layer() {
return _layer;
}
void ModelVisual::set_layer(int layer) {
_layer = layer;
}
//ModelVisualEntries
Ref<ModelVisualEntry> ModelVisual::get_visual_entry(const int index) const {
ERR_FAIL_INDEX_V(index, _visual_entries.size(), Ref<ModelVisualEntry>());
return _visual_entries.get(index);
}
void ModelVisual::set_visual_entry(const int index, const Ref<ModelVisualEntry> visual_entry) {
ERR_FAIL_INDEX(index, _visual_entries.size());
_visual_entries.set(index, visual_entry);
}
void ModelVisual::add_visual_entry(const Ref<ModelVisualEntry> visual_entry) {
_visual_entries.push_back(visual_entry);
}
void ModelVisual::remove_visual_entry(const int index) {
ERR_FAIL_INDEX(index, _visual_entries.size());
_visual_entries.remove_at(index);
}
int ModelVisual::get_visual_entry_count() const {
return _visual_entries.size();
}
Vector<Variant> ModelVisual::get_visual_entries() {
VARIANT_ARRAY_GET(_visual_entries);
}
void ModelVisual::set_visual_entries(const Vector<Variant> &visual_entries) {
VARIANT_ARRAY_SET(visual_entries, _visual_entries, ModelVisualEntry);
}
ModelVisual::ModelVisual() {
_layer = 0;
}
ModelVisual::~ModelVisual() {
_visual_entries.clear();
}
void ModelVisual::_validate_property(PropertyInfo &property) const {
String name = property.name;
if (name == "layer") {
property.hint_string = ESS::get_singleton()->texture_layers_get();
}
}
void ModelVisual::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_layer"), &ModelVisual::get_layer);
ClassDB::bind_method(D_METHOD("set_layer", "layer"), &ModelVisual::set_layer);
ADD_PROPERTY(PropertyInfo(Variant::INT, "layer", PROPERTY_HINT_ENUM, ""), "set_layer", "get_layer");
//ModelVisualEntry
ClassDB::bind_method(D_METHOD("get_visual_entry", "index"), &ModelVisual::get_visual_entry);
ClassDB::bind_method(D_METHOD("set_visual_entry", "index", "data"), &ModelVisual::set_visual_entry);
ClassDB::bind_method(D_METHOD("add_visual_entry", "visual_entry"), &ModelVisual::add_visual_entry);
ClassDB::bind_method(D_METHOD("remove_visual_entry", "index"), &ModelVisual::remove_visual_entry);
ClassDB::bind_method(D_METHOD("get_visual_entry_count"), &ModelVisual::get_visual_entry_count);
ClassDB::bind_method(D_METHOD("get_visual_entries"), &ModelVisual::get_visual_entries);
ClassDB::bind_method(D_METHOD("set_visual_entries", "visual_entrys"), &ModelVisual::set_visual_entries);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "get_visual_entries", PROPERTY_HINT_NONE, "17/17:ModelVisualEntry", PROPERTY_USAGE_DEFAULT, "ModelVisualEntry"), "set_visual_entries", "get_visual_entries");
}
================================================
FILE: data/items/model_visual.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef MODEL_VISUAL_H
#define MODEL_VISUAL_H
#include "core/version.h"
#include "core/io/resource.h"
#include "../../item_enums.h"
#include "model_visual_entry.h"
class ModelVisual : public Resource {
GDCLASS(ModelVisual, Resource);
public:
int get_layer();
void set_layer(int layer);
//ModelVisualEntry
Ref<ModelVisualEntry> get_visual_entry(const int index) const;
void set_visual_entry(const int index, const Ref<ModelVisualEntry> visual_entry);
void add_visual_entry(const Ref<ModelVisualEntry> visual_entry);
void remove_visual_entry(const int index);
int get_visual_entry_count() const;
Vector<Variant> get_visual_entries();
void set_visual_entries(const Vector<Variant> &visual_entries);
ModelVisual();
~ModelVisual();
protected:
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
private:
int _layer;
Vector<Ref<ModelVisualEntry> > _visual_entries;
};
#endif
================================================
FILE: data/items/model_visual_entry.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "model_visual_entry.h"
#include "../../singletons/ess.h"
const String ModelVisualEntry::BINDING_STRING_MODEL_VISUAL_ENTRY_TYPES = "Bone,Attachment";
ModelVisualEntry::ModenVisualEntryType ModelVisualEntry::get_type() const {
return _type;
}
void ModelVisualEntry::set_type(const ModelVisualEntry::ModenVisualEntryType type) {
_type = type;
}
int ModelVisualEntry::get_override_layer() const {
return _override_layer;
}
void ModelVisualEntry::set_override_layer(const int layer) {
_override_layer = layer;
}
int ModelVisualEntry::get_entity_type() const {
return _entity_type;
}
void ModelVisualEntry::set_entity_type(const int value) {
_entity_type = value;
}
int ModelVisualEntry::get_bone() const {
return _bone;
}
void ModelVisualEntry::set_bone(const int value) {
_bone = value;
}
int ModelVisualEntry::get_group() const {
return _group;
}
void ModelVisualEntry::set_group(const int value) {
_group = value;
}
#ifdef MESH_DATA_RESOURCE_PRESENT
Ref<MeshDataResource> ModelVisualEntry::get_mesh(const int index) {
ERR_FAIL_INDEX_V(index, _entries.size(), Ref<MeshDataResource>());
return _entries[index].mesh;
}
void ModelVisualEntry::set_mesh(const int index, const Ref<MeshDataResource> &mesh) {
ERR_FAIL_INDEX(index, _entries.size());
_entries.write[index].mesh = mesh;
}
#endif
Ref<Texture> ModelVisualEntry::get_texture(const int index) {
ERR_FAIL_INDEX_V(index, _entries.size(), Ref<Texture>());
return _entries[index].texture;
}
void ModelVisualEntry::set_texture(const int index, const Ref<Texture> &texture) {
ERR_FAIL_INDEX(index, _entries.size());
_entries.write[index].texture = texture;
}
Color ModelVisualEntry::get_color(const int index) const {
ERR_FAIL_INDEX_V(index, _entries.size(), Color());
return _entries[index].color;
}
void ModelVisualEntry::set_color(const int index, const Color &color) {
ERR_FAIL_INDEX(index, _entries.size());
_entries.write[index].color = color;
}
Ref<PackedScene> ModelVisualEntry::get_attachment(const int index) {
ERR_FAIL_INDEX_V(index, _entries.size(), Ref<PackedScene>());
return _entries[index].attachment;
}
void ModelVisualEntry::set_attachment(const int index, const Ref<PackedScene> &attachment) {
ERR_FAIL_INDEX(index, _entries.size());
_entries.write[index].attachment = attachment;
}
Transform3D ModelVisualEntry::get_transform(const int index) const {
ERR_FAIL_INDEX_V(index, _entries.size(), Transform3D());
return _entries[index].transform;
}
void ModelVisualEntry::set_transform(const int index, const Transform3D &transform) {
ERR_FAIL_INDEX(index, _entries.size());
_entries.write[index].transform = transform;
}
int ModelVisualEntry::get_size() const {
return _entries.size();
}
void ModelVisualEntry::set_size(const int value) {
_entries.resize(value);
}
ModelVisualEntry::ModelVisualEntry() {
_type = MODEL_VISUAL_ENTRY_TYPE_BONE;
_override_layer = 0;
_entity_type = 0;
_bone = 0;
_group = 0;
_entries.resize(1);
}
ModelVisualEntry::~ModelVisualEntry() {
_entries.clear();
}
bool ModelVisualEntry::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
if (name.begins_with("entry_")) {
int index = name.get_slicec('_', 1).to_int();
if (index >= _entries.size()) {
_entries.resize(index + 1);
}
StringName p = name.get_slicec('/', 1);
if (p == "texture") {
_entries.write[index].texture = p_value;
return true;
#ifdef MESH_DATA_RESOURCE_PRESENT
} else if (p == "mesh") {
_entries.write[index].mesh = p_value;
return true;
#endif
} else if (p == "color") {
_entries.write[index].color = p_value;
return true;
} else if (p == "attachment") {
_entries.write[index].attachment = p_value;
return true;
} else if (p == "transform") {
_entries.write[index].transform = p_value;
return true;
}
}
return false;
}
bool ModelVisualEntry::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name.begins_with("entry_")) {
int index = name.get_slicec('_', 1).to_int();
if (index >= _entries.size()) {
return false;
}
StringName p = name.get_slicec('/', 1);
if (p == "texture") {
r_ret = _entries[index].texture;
return true;
#ifdef MESH_DATA_RESOURCE_PRESENT
} else if (p == "mesh") {
r_ret = _entries[index].mesh;
return true;
#endif
} else if (p == "color") {
r_ret = _entries[index].color;
return true;
} else if (p == "attachment") {
r_ret = _entries[index].attachment;
return true;
} else if (p == "transform") {
r_ret = _entries[index].transform;
return true;
}
}
return false;
}
void ModelVisualEntry::_get_property_list(List<PropertyInfo> *p_list) const {
for (int i = 0; i < _entries.size(); ++i) {
if (_type == ModelVisualEntry::MODEL_VISUAL_ENTRY_TYPE_BONE) {
#ifdef MESH_DATA_RESOURCE_PRESENT
p_list->push_back(PropertyInfo(Variant::OBJECT, "entry_" + itos(i) + "/mesh", PROPERTY_HINT_RESOURCE_TYPE, "MeshDataResource", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
#endif
p_list->push_back(PropertyInfo(Variant::OBJECT, "entry_" + itos(i) + "/texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::COLOR, "entry_" + itos(i) + "/color", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
} else {
p_list->push_back(PropertyInfo(Variant::OBJECT, "entry_" + itos(i) + "/attachment", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
}
p_list->push_back(PropertyInfo(Variant::TRANSFORM3D, "entry_" + itos(i) + "/transform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
}
}
void ModelVisualEntry::_validate_property(PropertyInfo &property) const {
String name = property.name;
if (_type == ModelVisualEntry::MODEL_VISUAL_ENTRY_TYPE_BONE) {
if (name == "entity_type") {
property.usage = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED;
property.hint_string = ESS::get_singleton()->entity_types_get();
} else if (name == "bone") {
if (ESS::get_singleton()->skeletons_bones_count() > _entity_type) {
property.hint_string = ESS::get_singleton()->skeletons_bones_index_get(_entity_type);
} else {
property.hint_string = "";
}
}
} else {
if (name == "entity_type") {
property.usage = PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED;
} else if (name == "bone") {
property.hint_string = EntityEnums::BINDING_STRING_COMMON_CHARCATER_SKELETON_POINTS;
}
}
if (name == "group") {
property.hint_string = ESS::get_singleton()->model_visual_groups_get();
} else if (name == "override_layer") {
property.hint_string = ESS::get_singleton()->texture_layers_get();
}
}
void ModelVisualEntry::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_type"), &ModelVisualEntry::get_type);
ClassDB::bind_method(D_METHOD("set_type", "value"), &ModelVisualEntry::set_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, ModelVisualEntry::BINDING_STRING_MODEL_VISUAL_ENTRY_TYPES, PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_type", "get_type");
ClassDB::bind_method(D_METHOD("get_override_layer"), &ModelVisualEntry::get_override_layer);
ClassDB::bind_method(D_METHOD("set_override_layer", "value"), &ModelVisualEntry::set_override_layer);
ADD_PROPERTY(PropertyInfo(Variant::INT, "override_layer", PROPERTY_HINT_ENUM, ""), "set_override_layer", "get_override_layer");
ClassDB::bind_method(D_METHOD("get_entity_type"), &ModelVisualEntry::get_entity_type);
ClassDB::bind_method(D_METHOD("set_entity_type", "value"), &ModelVisualEntry::set_entity_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "entity_type", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_entity_type", "get_entity_type");
ClassDB::bind_method(D_METHOD("get_bone"), &ModelVisualEntry::get_bone);
ClassDB::bind_method(D_METHOD("set_bone", "value"), &ModelVisualEntry::set_bone);
ADD_PROPERTY(PropertyInfo(Variant::INT, "bone", PROPERTY_HINT_ENUM), "set_bone", "get_bone");
ClassDB::bind_method(D_METHOD("get_group"), &ModelVisualEntry::get_group);
ClassDB::bind_method(D_METHOD("set_group", "value"), &ModelVisualEntry::set_group);
ADD_PROPERTY(PropertyInfo(Variant::INT, "group", PROPERTY_HINT_ENUM), "set_group", "get_group");
#ifdef MESH_DATA_RESOURCE_PRESENT
ClassDB::bind_method(D_METHOD("get_mesh", "index"), &ModelVisualEntry::get_mesh);
ClassDB::bind_method(D_METHOD("set_mesh", "index", "value"), &ModelVisualEntry::set_mesh);
#endif
ClassDB::bind_method(D_METHOD("get_texture", "index"), &ModelVisualEntry::get_texture);
ClassDB::bind_method(D_METHOD("set_texture", "index", "value"), &ModelVisualEntry::set_texture);
ClassDB::bind_method(D_METHOD("get_color"), &ModelVisualEntry::get_color);
ClassDB::bind_method(D_METHOD("set_color", "value"), &ModelVisualEntry::set_color);
ClassDB::bind_method(D_METHOD("get_attachment"), &ModelVisualEntry::get_attachment);
ClassDB::bind_method(D_METHOD("set_attachment", "value"), &ModelVisualEntry::set_attachment);
ClassDB::bind_method(D_METHOD("get_transform", "index"), &ModelVisualEntry::get_transform);
ClassDB::bind_method(D_METHOD("set_transform", "index", "value"), &ModelVisualEntry::set_transform);
ClassDB::bind_method(D_METHOD("get_size"), &ModelVisualEntry::get_size);
ClassDB::bind_method(D_METHOD("set_size", "value"), &ModelVisualEntry::set_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_size", "get_size");
BIND_ENUM_CONSTANT(MODEL_VISUAL_ENTRY_TYPE_BONE);
BIND_ENUM_CONSTANT(MODEL_VISUAL_ENTRY_TYPE_ATTACHMENT);
}
================================================
FILE: data/items/model_visual_entry.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef MODEL_VISUAL_ENTRY_H
#define MODEL_VISUAL_ENTRY_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/string/ustring.h"
#include "core/math/color.h"
#include "scene/resources/texture.h"
#include "../../entity_enums.h"
#include "../../item_enums.h"
#include "scene/resources/mesh.h"
#include "scene/resources/packed_scene.h"
#ifdef MESH_DATA_RESOURCE_PRESENT
#include "../../../mesh_data_resource/mesh_data_resource.h"
#endif
class ModelVisualEntry : public Resource {
GDCLASS(ModelVisualEntry, Resource);
public:
enum ModenVisualEntryType {
MODEL_VISUAL_ENTRY_TYPE_BONE = 0,
MODEL_VISUAL_ENTRY_TYPE_ATTACHMENT
};
static const String BINDING_STRING_MODEL_VISUAL_ENTRY_TYPES;
public:
ModelVisualEntry::ModenVisualEntryType get_type() const;
void set_type(const ModelVisualEntry::ModenVisualEntryType type);
int get_override_layer() const;
void set_override_layer(const int layer);
int get_entity_type() const;
void set_entity_type(const int value);
int get_bone() const;
void set_bone(const int value);
int get_group() const;
void set_group(const int value);
#ifdef MESH_DATA_RESOURCE_PRESENT
Ref<MeshDataResource> get_mesh(const int index);
void set_mesh(const int index, const Ref<MeshDataResource> &mesh);
#endif
Ref<Texture> get_texture(const int index);
void set_texture(const int index, const Ref<Texture> &texture);
Color get_color(const int index) const;
void set_color(const int index, const Color &color);
Ref<PackedScene> get_attachment(const int index);
void set_attachment(const int index, const Ref<PackedScene> &attachment);
Transform3D get_transform(const int index) const;
void set_transform(const int index, const Transform3D &transform);
int get_size() const;
void set_size(const int value);
ModelVisualEntry();
~ModelVisualEntry();
protected:
struct MVEE {
#ifdef MESH_DATA_RESOURCE_PRESENT
Ref<MeshDataResource> mesh;
#endif
Ref<Texture> texture;
Color color;
Ref<PackedScene> attachment;
Transform3D transform;
MVEE() {
color = Color(1, 1, 1, 1);
}
~MVEE() {
#ifdef MESH_DATA_RESOURCE_PRESENT
mesh.unref();
#endif
texture.unref();
attachment.unref();
}
};
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
private:
ModelVisualEntry::ModenVisualEntryType _type;
int _override_layer;
int _entity_type;
int _bone;
int _group;
Vector<MVEE> _entries;
};
VARIANT_ENUM_CAST(ModelVisualEntry::ModenVisualEntryType);
#endif
================================================
FILE: data/loot/loot_data_base.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "loot_data_base.h"
#include "../../defines.h"
int LootDataBase::get_loot_db_size() const {
return _loot_dbs.size();
}
void LootDataBase::set_loot_db_size(const float value) {
_loot_dbs.resize(value);
}
int LootDataBase::get_items_size() const {
return _items.size();
}
void LootDataBase::set_items_size(const int value) {
_items.resize(value);
}
float LootDataBase::get_loot_db_chance(const int index) const {
ERR_FAIL_INDEX_V(index, _loot_dbs.size(), 0);
return _loot_dbs.get(index).chance;
}
void LootDataBase::set_loot_db_chance(const int index, const float value) {
ERR_FAIL_INDEX(index, _loot_dbs.size());
LootDBLDF l = _loot_dbs.get(index);
l.chance = value;
_loot_dbs.set(index, l);
}
Ref<LootDataBase> LootDataBase::get_loot_db(const int index) const {
ERR_FAIL_INDEX_V(index, _loot_dbs.size(), 0);
return _loot_dbs.get(index).loot_db;
}
void LootDataBase::set_loot_db(const int index, const Ref<LootDataBase> &value) {
ERR_FAIL_INDEX(index, _loot_dbs.size());
LootDBLDF l = _loot_dbs.get(index);
l.loot_db = value;
_loot_dbs.set(index, l);
}
float LootDataBase::get_item_chance(const int index) const {
ERR_FAIL_INDEX_V(index, _items.size(), 0);
return _items.get(index).chance;
}
void LootDataBase::set_item_chance(const int index, const float value) {
ERR_FAIL_INDEX(index, _items.size());
LootDBItem l = _items.get(index);
l.chance = value;
_items.set(index, l);
}
Ref<ItemTemplate> LootDataBase::get_item(const int index) const {
ERR_FAIL_INDEX_V(index, _items.size(), 0);
return _items.get(index).item;
}
void LootDataBase::set_item(const int index, const Ref<ItemTemplate> &value) {
ERR_FAIL_INDEX(index, _items.size());
LootDBItem l = _items.get(index);
l.item = value;
_items.set(index, l);
}
Array LootDataBase::get_loot() {
return call("_get_loot");
}
Array LootDataBase::_get_loot() {
Array arr;
for (int i = 0; i < _loot_dbs.size(); ++i) {
LootDBLDF l = _loot_dbs.get(i);
if (!l.loot_db.is_valid())
continue;
Math::randomize();
float val = Math::randf() * 100.0;
if (val < l.chance) {
arr.append(l.loot_db->get_loot());
}
}
for (int i = 0; i < _items.size(); ++i) {
LootDBItem l = _items.get(i);
if (!l.item.is_valid())
continue;
Math::randomize();
float val = Math::randf() * 100.0;
if (val < l.chance) {
arr.append(l.item);
}
}
return arr;
}
LootDataBase::LootDataBase() {
}
LootDataBase::~LootDataBase() {
_loot_dbs.clear();
_items.clear();
}
bool LootDataBase::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
if (name.begins_with("loot_dbs/")) {
int index = name.get_slicec('/', 1).to_int();
String what = name.get_slicec('/', 2);
if (_loot_dbs.size() <= index) {
set_loot_db_size(index);
}
LootDBLDF ldb = _loot_dbs.get(index);
if (what == "chance") {
ldb.chance = p_value;
_loot_dbs.set(index, ldb);
return true;
} else if (what == "loot_db") {
ldb.loot_db = p_value;
_loot_dbs.set(index, ldb);
return true;
}
return false;
} else if (name.begins_with("items/")) {
int index = name.get_slicec('/', 1).to_int();
String what = name.get_slicec('/', 2);
if (_items.size() <= index) {
set_items_size(index);
}
LootDBItem ldb = _items.get(index);
if (what == "chance") {
ldb.chance = p_value;
_items.set(index, ldb);
return true;
} else if (what == "item_template") {
ldb.item = p_value;
_items.set(index, ldb);
return true;
}
return false;
}
return true;
}
bool LootDataBase::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name.begins_with("loot_dbs/")) {
int index = name.get_slicec('/', 1).to_int();
String what = name.get_slicec('/', 2);
if (_loot_dbs.size() <= index) {
return false;
}
LootDBLDF ldb = _loot_dbs.get(index);
if (what == "chance") {
r_ret = ldb.chance;
return true;
} else if (what == "loot_db") {
r_ret = ldb.loot_db;
return true;
}
return false;
} else if (name.begins_with("items/")) {
int index = name.get_slicec('/', 1).to_int();
String what = name.get_slicec('/', 2);
if (_items.size() <= index) {
return false;
}
LootDBItem ldb = _items.get(index);
if (what == "chance") {
r_ret = ldb.chance;
return true;
} else if (what == "item_template") {
r_ret = ldb.item;
return true;
}
return false;
}
return true;
}
void LootDataBase::_get_property_list(List<PropertyInfo> *p_list) const {
int property_usange = PROPERTY_USAGE_DEFAULT;
for (int i = 0; i < _loot_dbs.size(); ++i) {
p_list->push_back(PropertyInfo(Variant::REAL, "loot_dbs/" + itos(i) + "/chance", PROPERTY_HINT_NONE, "", property_usange));
p_list->push_back(PropertyInfo(Variant::OBJECT, "loot_dbs/" + itos(i) + "/loot_db", PROPERTY_HINT_RESOURCE_TYPE, "LootDataBase", property_usange));
}
for (int i = 0; i < _items.size(); ++i) {
p_list->push_back(PropertyInfo(Variant::REAL, "items/" + itos(i) + "/chance", PROPERTY_HINT_NONE, "", property_usange));
p_list->push_back(PropertyInfo(Variant::OBJECT, "items/" + itos(i) + "/item_template", PROPERTY_HINT_RESOURCE_TYPE, "ItemTemplate", property_usange));
}
}
void LootDataBase::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_loot_db_size"), &LootDataBase::get_loot_db_size);
ClassDB::bind_method(D_METHOD("set_loot_db_size", "value"), &LootDataBase::set_loot_db_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "loot_db_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_loot_db_size", "get_loot_db_size");
ClassDB::bind_method(D_METHOD("get_items_size"), &LootDataBase::get_items_size);
ClassDB::bind_method(D_METHOD("set_items_size", "value"), &LootDataBase::set_items_size);
ADD_PROPERTY(PropertyInfo(Variant::INT, "items_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_items_size", "get_items_size");
ClassDB::bind_method(D_METHOD("get_loot_db_chance", "index"), &LootDataBase::get_loot_db_chance);
ClassDB::bind_method(D_METHOD("set_loot_db_chance", "index", "value"), &LootDataBase::set_loot_db_chance);
ClassDB::bind_method(D_METHOD("get_loot_db", "index"), &LootDataBase::get_loot_db);
ClassDB::bind_method(D_METHOD("set_loot_db", "index", "value"), &LootDataBase::set_loot_db);
ClassDB::bind_method(D_METHOD("get_item_chance", "index"), &LootDataBase::get_item_chance);
ClassDB::bind_method(D_METHOD("set_item_chance", "index", "value"), &LootDataBase::set_item_chance);
ClassDB::bind_method(D_METHOD("get_item", "index"), &LootDataBase::get_item);
ClassDB::bind_method(D_METHOD("set_item", "index", "value"), &LootDataBase::set_item);
//GDVIRTUAL_BIND("_get_loot");
ClassDB::bind_method(D_METHOD("get_loot"), &LootDataBase::get_loot);
ClassDB::bind_method(D_METHOD("_get_loot"), &LootDataBase::_get_loot);
}
================================================
FILE: data/loot/loot_data_base.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef LOOT_DATA_BASE_H
#define LOOT_DATA_BASE_H
#include "core/version.h"
#include "core/templates/vector.h"
#include "core/variant/array.h"
#include "../items/item_template.h"
class LootDataBase : public Resource {
GDCLASS(LootDataBase, Resource);
public:
int get_loot_db_size() const;
void set_loot_db_size(const float value);
int get_items_size() const;
void set_items_size(const int value);
float get_loot_db_chance(const int index) const;
void set_loot_db_chance(const int index, const float value);
Ref<LootDataBase> get_loot_db(const int index) const;
void set_loot_db(const int index, const Ref<LootDataBase> &value);
float get_item_chance(const int index) const;
void set_item_chance(const int index, const float value);
Ref<ItemTemplate> get_item(const int index) const;
void set_item(const int index, const Ref<ItemTemplate> &value);
Array get_loot();
Array _get_loot();
LootDataBase();
~LootDataBase();
protected:
struct LootDBLDF {
float chance;
Ref<LootDataBase> loot_db;
LootDBLDF() {
chance = 0;
}
};
struct LootDBItem {
float chance;
Ref<ItemTemplate> item;
LootDBItem() {
chance = 0;
}
};
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
static void _bind_methods();
private:
Vector<LootDBLDF> _loot_dbs;
Vector<LootDBItem> _items;
};
#endif
================================================
FILE: data/species/entity_species_data.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "entity_species_data.h"
#include "../spells/spell.h"
#include "../../singletons/ess.h"
#include "core/version.h"
int EntitySpeciesData::get_id() const {
return _id;
}
void EntitySpeciesData::set_id(const int value) {
_id = value;
}
int EntitySpeciesData::get_type() const {
return _type;
}
void EntitySpeciesData::set_type(const int value) {
_type = value;
}
String EntitySpeciesData::get_text_description() const {
return _text_description;
}
void EntitySpeciesData::set_text_description(const String &value) {
_text_description = value;
}
//ModelData
Ref<SpeciesModelData> EntitySpeciesData::get_model_data(const int index) const {
ERR_FAIL_INDEX_V(index, _model_datas.size(), Ref<SpeciesModelData>());
return _model_datas.get(index);
}
void EntitySpeciesData::set_model_data(const int index, const Ref<SpeciesModelData> &model_data) {
ERR_FAIL_INDEX(index, _model_datas.size());
_model_datas.set(index, model_data);
}
void EntitySpeciesData::add_model_data(const Ref<SpeciesModelData> &model_data) {
_model_datas.push_back(model_data);
}
void EntitySpeciesData::remove_model_data(const int index) {
ERR_FAIL_INDEX(index, _model_datas.size());
_model_datas.remove_at(index);
}
int EntitySpeciesData::get_model_data_count() const {
return _model_datas.size();
}
Vector<Variant> EntitySpeciesData::get_model_datas() {
VARIANT_ARRAY_GET(_model_datas);
}
void EntitySpeciesData::set_model_datas(const Vector<Variant> &model_datas) {
VARIANT_ARRAY_SET(model_datas, _model_datas, SpeciesModelData);
}
//Spells
Ref<Spell> EntitySpeciesData::get_spell(const int index) const {
ERR_FAIL_INDEX_V(index, _spells.size(), Ref<Spell>());
return _spells.get(index);
}
void EntitySpeciesData::set_spell(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _spells.size());
_spells.set(index, spell);
}
void EntitySpeciesData::add_spell(const Ref<Spell> &spell) {
_spells.push_back(spell);
}
void EntitySpeciesData::remove_spell(const int index) {
ERR_FAIL_INDEX(index, _spells.size());
_spells.remove_at(index);
}
int EntitySpeciesData::get_spell_count() const {
return _spells.size();
}
Vector<Variant> EntitySpeciesData::get_spells() {
VARIANT_ARRAY_GET(_spells);
}
void EntitySpeciesData::set_spells(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _spells, Spell);
}
//Auras
Ref<Spell> EntitySpeciesData::get_aura(const int index) const {
ERR_FAIL_INDEX_V(index, _auras.size(), Ref<Spell>());
return _auras.get(index);
}
void EntitySpeciesData::set_aura(const int index, const Ref<Spell> &aura) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.set(index, aura);
}
void EntitySpeciesData::add_aura(const Ref<Spell> &aura) {
_auras.push_back(aura);
}
void EntitySpeciesData::remove_aura(const int index) {
ERR_FAIL_INDEX(index, _auras.size());
_auras.remove_at(index);
}
int EntitySpeciesData::get_aura_count() const {
return _auras.size();
}
Vector<Variant> EntitySpeciesData::get_auras() {
VARIANT_ARRAY_GET(_auras);
}
void EntitySpeciesData::set_auras(const Vector<Variant> &auras) {
_auras.clear();
for (int i = 0; i < auras.size(); i++) {
Ref<Spell> aura = Ref<Spell>(auras[i]);
_auras.push_back(aura);
}
}
String EntitySpeciesData::generate_name(int seed) {
if (has_method("_generate_name")) {
return call("_generate_name", seed);
}
return "";
}
EntitySpeciesData::EntitySpeciesData() {
_id = 0;
_type = 0;
}
EntitySpeciesData::~EntitySpeciesData() {
_model_datas.clear();
_spells.clear();
_auras.clear();
}
void EntitySpeciesData::_validate_property(PropertyInfo &property) const {
if (property.name == "type") {
property.hint_string = ESS::get_singleton()->entity_types_get();
}
}
void EntitySpeciesData::_bind_methods() {
////GDVIRTUAL_BIND("_generate_name", "seed");
ClassDB::bind_method(D_METHOD("generate_name"), &EntitySpeciesData::generate_name);
ClassDB::bind_method(D_METHOD("get_id"), &EntitySpeciesData::get_id);
ClassDB::bind_method(D_METHOD("set_id", "value"), &EntitySpeciesData::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ClassDB::bind_method(D_METHOD("get_type"), &EntitySpeciesData::get_type);
ClassDB::bind_method(D_METHOD("set_type", "value"), &EntitySpeciesData::set_type);
ADD_PROPERTY(PropertyInfo(Variant::INT, "type", PROPERTY_HINT_ENUM, ""), "set_type", "get_type");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
ClassDB::bind_method(D_METHOD("get_text_description"), &EntitySpeciesData::get_text_description);
ClassDB::bind_method(D_METHOD("set_text_description", "value"), &EntitySpeciesData::set_text_description);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_description"), "set_text_description", "get_text_description");
//ModelData
ClassDB::bind_method(D_METHOD("get_model_data", "index"), &EntitySpeciesData::get_model_data);
ClassDB::bind_method(D_METHOD("set_model_data", "index", "data"), &EntitySpeciesData::set_model_data);
ClassDB::bind_method(D_METHOD("add_model_data", "model_data"), &EntitySpeciesData::add_model_data);
ClassDB::bind_method(D_METHOD("remove_model_data", "index"), &EntitySpeciesData::remove_model_data);
ClassDB::bind_method(D_METHOD("get_model_data_count"), &EntitySpeciesData::get_model_data_count);
ClassDB::bind_method(D_METHOD("get_model_datas"), &EntitySpeciesData::get_model_datas);
ClassDB::bind_method(D_METHOD("set_model_datas", "model_datas"), &EntitySpeciesData::set_model_datas);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "model_datas", PROPERTY_HINT_NONE, "17/17:SpeciesModelData", PROPERTY_USAGE_DEFAULT, "SpeciesModelData"), "set_model_datas", "get_model_datas");
//Spells
ClassDB::bind_method(D_METHOD("get_spell", "index"), &EntitySpeciesData::get_spell);
ClassDB::bind_method(D_METHOD("set_spell", "index", "data"), &EntitySpeciesData::set_spell);
ClassDB::bind_method(D_METHOD("add_spell", "spell"), &EntitySpeciesData::add_spell);
ClassDB::bind_method(D_METHOD("remove_spell", "index"), &EntitySpeciesData::remove_spell);
ClassDB::bind_method(D_METHOD("get_spell_count"), &EntitySpeciesData::get_spell_count);
ClassDB::bind_method(D_METHOD("get_spells"), &EntitySpeciesData::get_spells);
ClassDB::bind_method(D_METHOD("set_spells", "spells"), &EntitySpeciesData::set_spells);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "spells", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_spells", "get_spells");
//Auras
ClassDB::bind_method(D_METHOD("get_aura", "index"), &EntitySpeciesData::get_aura);
ClassDB::bind_method(D_METHOD("set_aura", "index", "data"), &EntitySpeciesData::set_aura);
ClassDB::bind_method(D_METHOD("add_aura", "aura"), &EntitySpeciesData::add_aura);
ClassDB::bind_method(D_METHOD("remove_aura", "index"), &EntitySpeciesData::remove_aura);
ClassDB::bind_method(D_METHOD("get_aura_count"), &EntitySpeciesData::get_aura_count);
ClassDB::bind_method(D_METHOD("get_auras"), &EntitySpeciesData::get_auras);
ClassDB::bind_method(D_METHOD("set_auras", "auras"), &EntitySpeciesData::set_auras);
ADD_PROPERTY(PropertyInfo(Variant::ARRAY, "auras", PROPERTY_HINT_NONE, "17/17:Spell", PROPERTY_USAGE_DEFAULT, "Spell"), "set_auras", "get_auras");
}
================================================
FILE: data/species/entity_species_data.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef ENTITY_SPECIES_DATA_H
#define ENTITY_SPECIES_DATA_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/templates/vector.h"
#include "core/string/ustring.h"
#include "../../entity_enums.h"
#include "species_model_data.h"
class Spell;
class EntitySpeciesData : public Resource {
GDCLASS(EntitySpeciesData, Resource);
public:
int get_id() const;
void set_id(const int value);
int get_type() const;
void set_type(const int value);
String get_text_description() const;
void set_text_description(const String &value);
//ModelData
Ref<SpeciesModelData> get_model_data(const int index) const;
void set_model_data(const int index, const Ref<SpeciesModelData> &data);
void add_model_data(const Ref<SpeciesModelData> &data);
void remove_model_data(const int index);
int get_model_data_count() const;
Vector<Variant> get_model_datas();
void set_model_datas(const Vector<Variant> &datas);
//Spells
Ref<Spell> get_spell(const int index) const;
void set_spell(const int index, const Ref<Spell> &spell);
void add_spell(const Ref<Spell> &spell);
void remove_spell(const int index);
int get_spell_count() const;
Vector<Variant> get_spells();
void set_spells(const Vector<Variant> &spells);
//Auras
Ref<Spell> get_aura(const int index) const;
void set_aura(const int index, const Ref<Spell> &aura);
void add_aura(const Ref<Spell> &aura);
void remove_aura(const int index);
int get_aura_count() const;
Vector<Variant> get_auras();
void set_auras(const Vector<Variant> &auras);
String generate_name(int seed);
EntitySpeciesData();
~EntitySpeciesData();
protected:
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
private:
int _id;
int _type;
String _text_description;
Vector<Ref<SpeciesModelData> > _model_datas;
Vector<Ref<Spell> > _spells;
Vector<Ref<Spell> > _auras;
};
#endif
================================================
FILE: data/species/species_instance.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "species_instance.h"
#include "core/version.h"
#include "../../database/ess_resource_db.h"
#include "../../singletons/ess.h"
#include "entity_species_data.h"
int SpeciesInstance::get_id() const {
return _id;
}
void SpeciesInstance::set_id(const int value) {
_id = value;
}
int SpeciesInstance::get_species_id() const {
return _species_id;
}
void SpeciesInstance::set_species_id(int value) {
_id = value;
_species = ESS::get_singleton()->get_resource_db()->get_entity_species_data(_id);
}
StringName SpeciesInstance::get_species_path() const {
return _path;
}
void SpeciesInstance::set_species_path(const StringName &value) {
_path = value;
_species = ESS::get_singleton()->get_resource_db()->get_entity_species_data_path(_path);
}
Ref<EntitySpeciesData> SpeciesInstance::get_species() {
return _species;
}
void SpeciesInstance::set_species(const Ref<EntitySpeciesData> &value) {
_species = value;
if (_species.is_valid()) {
_path = _species->get_path();
} else {
_path = "";
}
}
int SpeciesInstance::get_skin_color_index() const {
return _skin_color_index;
}
void SpeciesInstance::set_skin_color_index(const int value) {
_skin_color_index = value;
}
int SpeciesInstance::get_hair_style_index() const {
return _hair_style_index;
}
void SpeciesInstance::set_hair_style_index(const int value) {
_hair_style_index = value;
}
int SpeciesInstance::get_hair_color_index() const {
return _hair_color_index;
}
void SpeciesInstance::set_hair_color_index(const int value) {
_hair_color_index = value;
}
int SpeciesInstance::get_head_index() const {
return _head_index;
}
void SpeciesInstance::set_head_index(const int value) {
_head_index = value;
}
Dictionary SpeciesInstance::to_dict() {
return call("_to_dict");
}
void SpeciesInstance::from_dict(const Dictionary &dict) {
call("_from_dict", dict);
}
Dictionary SpeciesInstance::_to_dict() {
Dictionary dict;
dict["id"] = _id;
dict["species_path"] = _path;
dict["skin_color_index"] = _skin_color_index;
dict["hair_style_index"] = _hair_style_index;
dict["_hair_color_index"] = _hair_color_index;
dict["head_index"] = _head_index;
return dict;
}
void SpeciesInstance::_from_dict(const Dictionary &dict) {
ERR_FAIL_COND(dict.is_empty());
_id = dict.get("id", 0);
set_species_path(dict.get("species_path", ""));
_skin_color_index = dict.get("skin_color_index", 0);
_hair_style_index = dict.get("hair_style_index", 0);
_hair_color_index = dict.get("hair_color_index", 0);
_head_index = dict.get("head_index", 0);
}
SpeciesInstance::SpeciesInstance() {
_id = 0;
_species_id = 0;
_skin_color_index = 0;
_hair_style_index = 0;
_hair_color_index = 0;
_head_index = 0;
}
SpeciesInstance::~SpeciesInstance() {
_species.unref();
}
void SpeciesInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_id"), &SpeciesInstance::get_id);
ClassDB::bind_method(D_METHOD("set_id", "value"), &SpeciesInstance::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ClassDB::bind_method(D_METHOD("get_species_id"), &SpeciesInstance::get_species_id);
ClassDB::bind_method(D_METHOD("set_species_id", "value"), &SpeciesInstance::set_species_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "species_id"), "set_species_id", "get_species_id");
ClassDB::bind_method(D_METHOD("get_species"), &SpeciesInstance::get_species);
ClassDB::bind_method(D_METHOD("set_species", "value"), &SpeciesInstance::set_species);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "species", PROPERTY_HINT_RESOURCE_TYPE, "EntitySpeciesData"), "set_species", "get_species");
ClassDB::bind_method(D_METHOD("get_skin_color_index"), &SpeciesInstance::get_skin_color_index);
ClassDB::bind_method(D_METHOD("set_skin_color_index", "value"), &SpeciesInstance::set_skin_color_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "skin_color_index"), "set_skin_color_index", "get_skin_color_index");
ClassDB::bind_method(D_METHOD("get_hair_style_index"), &SpeciesInstance::get_hair_style_index);
ClassDB::bind_method(D_METHOD("set_hair_style_index", "value"), &SpeciesInstance::set_hair_style_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "hair_style_index"), "set_hair_style_index", "get_hair_style_index");
ClassDB::bind_method(D_METHOD("get_hair_color_index"), &SpeciesInstance::get_hair_color_index);
ClassDB::bind_method(D_METHOD("set_hair_color_index", "value"), &SpeciesInstance::set_hair_color_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "hair_color_index"), "set_hair_color_index", "get_hair_color_index");
ClassDB::bind_method(D_METHOD("get_head_index"), &SpeciesInstance::get_head_index);
ClassDB::bind_method(D_METHOD("set_head_index", "value"), &SpeciesInstance::set_head_index);
ADD_PROPERTY(PropertyInfo(Variant::INT, "head_index"), "set_head_index", "get_head_index");
//Serialization
//GDVIRTUAL_BIND("_from_dict", "dict");
//GDVIRTUAL_BIND("_to_dict");
ClassDB::bind_method(D_METHOD("from_dict", "dict"), &SpeciesInstance::from_dict);
ClassDB::bind_method(D_METHOD("to_dict"), &SpeciesInstance::to_dict);
ClassDB::bind_method(D_METHOD("_from_dict", "dict"), &SpeciesInstance::_from_dict);
ClassDB::bind_method(D_METHOD("_to_dict"), &SpeciesInstance::_to_dict);
}
================================================
FILE: data/species/species_instance.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef SPECIES_INSTANCE_H
#define SPECIES_INSTANCE_H
#include "core/version.h"
#include "core/io/resource.h"
#include "../items/model_visual_entry.h"
class EntitySpeciesData;
class SpeciesInstance : public Resource {
GDCLASS(SpeciesInstance, Resource);
public:
int get_id() const;
void set_id(const int value);
int get_species_id() const;
void set_species_id(const int value);
StringName get_species_path() const;
void set_species_path(const StringName &value);
Ref<EntitySpeciesData> get_species();
void set_species(const Ref<EntitySpeciesData> &value);
int get_skin_color_index() const;
void set_skin_color_index(const int value);
int get_hair_style_index() const;
void set_hair_style_index(const int value);
int get_hair_color_index() const;
void set_hair_color_index(const int value);
int get_head_index() const;
void set_head_index(const int value);
Dictionary to_dict();
void from_dict(const Dictionary &dict);
Dictionary _to_dict();
void _from_dict(const Dictionary &dict);
SpeciesInstance();
~SpeciesInstance();
protected:
static void _bind_methods();
private:
int _id;
StringName _path;
int _species_id;
Ref<EntitySpeciesData> _species;
int _skin_color_index;
int _hair_style_index;
int _hair_color_index;
int _head_index;
};
#endif
================================================
FILE: data/species/species_model_data.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "species_model_data.h"
#include "core/version.h"
#include "../../defines.h"
#include "../../singletons/ess.h"
#include "core/string/ustring.h"
int SpeciesModelData::get_id() {
return _id;
}
void SpeciesModelData::set_id(int value) {
_id = value;
}
int SpeciesModelData::get_bone_structure() const {
return _bone_structure;
}
void SpeciesModelData::set_bone_structure(const int value) {
_bone_structure = value;
}
Ref<PackedScene> SpeciesModelData::get_body() {
return _body;
}
void SpeciesModelData::set_body(Ref<PackedScene> value) {
_body = value;
}
//Entries
Ref<ModelVisualEntry> SpeciesModelData::get_visual(const int index) const {
ERR_FAIL_INDEX_V(index, _visuals.size(), Ref<ModelVisualEntry>());
return _visuals.get(index);
}
void SpeciesModelData::set_visual(const int index, const Ref<ModelVisualEntry> visual) {
ERR_FAIL_INDEX(index, _visuals.size());
_visuals.set(index, visual);
}
void SpeciesModelData::add_visual(const Ref<ModelVisualEntry> &visual) {
_visuals.push_back(visual);
}
void SpeciesModelData::remove_visual(const int index) {
ERR_FAIL_INDEX(index, _visuals.size());
_visuals.remove_at(index);
}
int SpeciesModelData::get_visual_count() const {
return _visuals.size();
}
Vector<Variant> SpeciesModelData::get_visuals() {
VARIANT_ARRAY_GET(_visuals);
}
void SpeciesModelData::set_visuals(const Vector<Variant> &visuals) {
VARIANT_ARRAY_SET(visuals, _visuals, ModelVisualEntry);
}
//Customizable Slots
String SpeciesModelData::get_customizable_slots_string() const {
return _customizable_slots_string;
}
void SpeciesModelData::set_customizable_slots_string(const String &value) {
_customizable_slots_string = value;
if (value == "") {
_customizable_slots.resize(0);
return;
}
_customizable_slots.resize(_customizable_slots_string.get_slice_count(","));
}
Ref<ModelVisualEntry> SpeciesModelData::get_customizable_slot_entry(const int slot_index, const int index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_slots.size(), Ref<ModelVisualEntry>());
ERR_FAIL_INDEX_V(index, _customizable_slots[slot_index].size(), Ref<ModelVisualEntry>());
return _customizable_slots[slot_index].get(index);
}
void SpeciesModelData::set_customizable_slot_entry(const int slot_index, const int index, const Ref<ModelVisualEntry> customizable_slot) {
ERR_FAIL_INDEX(slot_index, _customizable_slots.size());
ERR_FAIL_INDEX(index, _customizable_slots[slot_index].size());
_customizable_slots.write[slot_index].set(index, customizable_slot);
}
void SpeciesModelData::add_customizable_slot_entry(const int slot_index, const Ref<ModelVisualEntry> customizable_slot) {
ERR_FAIL_INDEX(slot_index, _customizable_slots.size());
_customizable_slots.write[slot_index].push_back(customizable_slot);
}
void SpeciesModelData::remove_customizable_slot_entry(const int slot_index, const int index) {
ERR_FAIL_INDEX(slot_index, _customizable_slots.size());
ERR_FAIL_INDEX(index, _customizable_slots.size());
_customizable_slots.write[slot_index].remove_at(index);
}
int SpeciesModelData::get_customizable_slot_count() const {
return _customizable_slots.size();
}
int SpeciesModelData::get_customizable_slot_entry_count(const int slot_index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_slots.size(), 0);
return _customizable_slots[slot_index].size();
}
Vector<Variant> SpeciesModelData::get_customizable_slot_entries(const int slot_index) const {
Vector<Variant> r;
ERR_FAIL_INDEX_V(slot_index, _customizable_slots.size(), r);
for (int i = 0; i < _customizable_slots[slot_index].size(); i++) {
#if GODOT4
r.push_back(_customizable_slots[slot_index][i]);
#else
r.push_back(_customizable_slots[slot_index][i].get_ref_ptr());
#endif
}
return r;
}
void SpeciesModelData::set_customizable_slot_entries(const int slot_index, const Vector<Variant> &customizable_slots) {
ERR_FAIL_INDEX(slot_index, _customizable_slots.size());
_customizable_slots.write[slot_index].clear();
for (int i = 0; i < customizable_slots.size(); i++) {
Ref<ModelVisualEntry> e = Ref<ModelVisualEntry>(customizable_slots[i]);
_customizable_slots.write[slot_index].push_back(e);
}
}
//Color Customizable Slots
String SpeciesModelData::get_customizable_color_slots_string() const {
return _customizable_color_slots_string;
}
void SpeciesModelData::set_customizable_color_slots_string(const String &value) {
_customizable_color_slots_string = value;
if (value == "") {
_visuals.resize(0);
return;
}
_customizable_color_slots.resize(_customizable_color_slots_string.get_slice_count(","));
}
Color SpeciesModelData::get_color_customizable_slot_color(const int slot_index, const int index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_color_slots.size(), Color());
ERR_FAIL_INDEX_V(index, _customizable_color_slots.size(), Color());
return _customizable_color_slots[slot_index].colors.get(index);
}
void SpeciesModelData::set_color_customizable_slot_color(const int slot_index, const int index, const Color color_customizable_slot) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
ERR_FAIL_INDEX(index, _customizable_color_slots[slot_index].colors.size());
_customizable_color_slots.write[slot_index].colors.set(index, color_customizable_slot);
}
void SpeciesModelData::add_color_customizable_slot_color(const int slot_index, const Color color_customizable_slot) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
_customizable_color_slots.write[slot_index].colors.push_back(color_customizable_slot);
}
void SpeciesModelData::remove_color_customizable_slot_color(const int slot_index, const int index) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
ERR_FAIL_INDEX(index, _customizable_color_slots.size());
_customizable_color_slots.write[slot_index].colors.remove_at(index);
}
Vector<Color> SpeciesModelData::get_color_customizable_slot_colors(const int slot_index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_color_slots.size(), Vector<Color>());
return _customizable_color_slots[slot_index].colors;
}
void SpeciesModelData::set_color_customizable_slot_colors(const int slot_index, const Vector<Color> &colors) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
_customizable_color_slots.write[slot_index].colors = colors;
}
uint64_t SpeciesModelData::get_color_customizable_slot_bone_slot_mask(const int slot_index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_color_slots.size(), 0);
return _customizable_color_slots[slot_index].bone_slot_mask;
}
void SpeciesModelData::set_color_customizable_slot_bone_slot_mask(const int slot_index, const uint64_t value) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
_customizable_color_slots.write[slot_index].bone_slot_mask = value;
}
int SpeciesModelData::get_color_customizable_slot_texture_layer(const int slot_index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_color_slots.size(), 0);
return _customizable_color_slots[slot_index].texture_layer;
}
void SpeciesModelData::set_color_customizable_slot_texture_layer(const int slot_index, const int value) {
ERR_FAIL_INDEX(slot_index, _customizable_color_slots.size());
_customizable_color_slots.write[slot_index].texture_layer = value;
}
int SpeciesModelData::get_color_customizable_count() const {
return _customizable_color_slots.size();
}
int SpeciesModelData::get_color_customizable_slot_count(const int slot_index) const {
ERR_FAIL_INDEX_V(slot_index, _customizable_color_slots.size(), 0);
return _customizable_color_slots[slot_index].colors.size();
}
SpeciesModelData::SpeciesModelData() {
_id = 0;
_bone_structure = 0;
}
SpeciesModelData::~SpeciesModelData() {
_body.unref();
_visuals.clear();
for (int i = 0; i < _customizable_slots.size(); ++i) {
_customizable_slots.write[i].clear();
}
for (int i = 0; i < _customizable_color_slots.size(); ++i) {
_customizable_color_slots.write[i].colors.clear();
}
_customizable_slots.clear();
_customizable_color_slots.clear();
}
bool SpeciesModelData::_set(const StringName &p_name, const Variant &p_value) {
String name = p_name;
if (name.begins_with("customizable_slots")) {
int index = name.get_slicec('/', 1).get_slicec('_', 0).to_int();
if (_customizable_slots.size() <= index) {
_customizable_slots.resize(index + 1);
}
set_customizable_slot_entries(index, p_value);
return true;
} else if (name.begins_with("customizable_color_slots")) {
int index = name.get_slicec('/', 1).get_slicec('_', 0).to_int();
if (_customizable_color_slots.size() <= index) {
_customizable_color_slots.resize(index + 1);
}
String prop = name.get_slicec('/', 2);
if (prop == "texture_layer") {
_customizable_color_slots.write[index].texture_layer = p_value;
return true;
} else if (prop == "bone_slot_mask") {
_customizable_color_slots.write[index].bone_slot_mask = p_value;
return true;
} else if (prop == "colors") {
_customizable_color_slots.write[index].colors = p_value;
return true;
}
return false;
}
return false;
}
bool SpeciesModelData::_get(const StringName &p_name, Variant &r_ret) const {
String name = p_name;
if (name.begins_with("customizable_slots")) {
int index = name.get_slicec('/', 1).get_slicec('_', 0).to_int();
if (_customizable_slots.size() <= index) {
return false;
}
r_ret = get_customizable_slot_entries(index);
return true;
} else if (name.begins_with("customizable_color_slots")) {
int index = name.get_slicec('/', 1).get_slicec('_', 0).to_int();
if (_customizable_color_slots.size() <= index) {
return false;
}
String prop = name.get_slicec('/', 2);
if (prop == "texture_layer") {
r_ret = _customizable_color_slots[index].texture_layer;
return true;
} else if (prop == "bone_slot_mask") {
r_ret = _customizable_color_slots[index].bone_slot_mask;
return true;
} else if (prop == "colors") {
r_ret = _customizable_color_slots[index].colors;
return true;
}
return false;
}
return false;
}
void SpeciesModelData::_get_property_list(List<PropertyInfo> *p_list) const {
int count = _customizable_slots_string.get_slice_count(",");
for (int i = 0; i < count; ++i) {
p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_slots/" + itos(i) + "_" + _customizable_slots_string.get_slicec(',', i), PROPERTY_HINT_NONE, "17/17:ModelVisualEntry", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "ModelVisualEntry"));
}
count = _customizable_color_slots_string.get_slice_count(",");
for (int i = 0; i < count; ++i) {
p_list->push_back(PropertyInfo(Variant::INT, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/texture_layer", PROPERTY_HINT_ENUM, ESS::get_singleton()->texture_layers_get(), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED));
p_list->push_back(PropertyInfo(Variant::INT, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/bone_slot_mask", PROPERTY_HINT_FLAGS, ESS::get_singleton()->skeletons_bones_index_get(_bone_structure), PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL));
p_list->push_back(PropertyInfo(Variant::ARRAY, "customizable_color_slots/" + itos(i) + "_" + _customizable_color_slots_string.get_slicec(',', i) + "/colors", PROPERTY_HINT_NONE, "17/17:Color", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_INTERNAL, "Color"));
}
}
void SpeciesModelData::_validate_property(PropertyInfo &property) const {
String prop = property.name;
if (prop == "bone_structure") {
property.hint_string = ESS::get_singleton()->entity_types_get();
}
}
void SpeciesModelData::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_id"), &SpeciesModelData::get_id);
ClassDB::bind_method(D_METHOD("set_id", "value"), &SpeciesModelData::set_id);
ADD_PROPERTY(PropertyInfo(Variant::INT, "id"), "set_id", "get_id");
ClassDB::bind_method(D_METHOD("get_bone_structure"), &SpeciesModelData::get_bone_structure);
ClassDB::bind_method(D_METHOD("set_bone_structure", "value"), &SpeciesModelData::set_bone_structure);
ADD_PROPERTY(PropertyInfo(Variant::INT, "bone_structure", PROPERTY_HINT_ENUM, "", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), "set_bone_structure", "get_bone_structure");
ADD_PROPERTY(PropertyInfo(Variant::STRING, "text_name"), "set_name", "get_name");
ClassDB::bind_method(D_METHOD("get_body"), &SpeciesModelData::get_body);
ClassDB::bind_method(D_METHOD("set_body", "value"), &SpeciesModelData::set_body);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "body", PROPERTY_HINT_RESOURCE_TYPE, "PackedScene"), "set_body", "get_body");
//Entries
ClassDB::bind_method(D_METHOD("get_visual", "index"), &SpeciesModelData::get_visual);
ClassDB::bind_method(D_METHOD("set_visual", "index", "data"), &SpeciesModelData::set_visual);
ClassDB::bind_method(D_METHOD("add_visual", "visual"), &SpeciesModelData::add_visual);
ClassDB::bind_method(D_METHOD("remove_visual", "index"), &SpeciesModelData::remove_visual);
ClassDB::bind_method(D_METHOD("get_visual_count"), &SpeciesModelData::get_visual_count);
ClassDB::bind_method(D_METHOD("get_visuals"), &SpeciesModelData::get_visuals);
ClassDB::bind_method(D_METHOD("set_visuals", "visuals"), &SpeciesModelData::set_visuals);
//Customizable Slots
ClassDB::bind_method(D_METHOD("get_customizable_slots_string"), &SpeciesModelData::get_customizable_slots_string);
ClassDB::bind_method(D_METHOD("set_customizable_slots_string", "value"), &SpeciesModelData::set_customizable_slots_string);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "customizable_slots_string"), "set_customizable_slots_string", "get_customizable_slots_string");
ClassDB::bind_method(D_METHOD("get_customizable_slot_entry", "slot_index", "index"), &SpeciesModelData::get_customizable_slot_entry);
ClassDB::bind_method(D_METHOD("set_customizable_slot_entry", "slot_index", "index", "data"), &SpeciesModelData::set_customizable_slot_entry);
ClassDB::bind_method(D_METHOD("add_customizable_slot_entry", "slot_index", "customizable_slot"), &SpeciesModelData::add_customizable_slot_entry);
ClassDB::bind_method(D_METHOD("remove_customizable_slot_entry", "slot_index", "index"), &SpeciesModelData::remove_customizable_slot_entry);
ClassDB::bind_method(D_METHOD("get_customizable_slot_count"), &SpeciesModelData::get_customizable_slot_count);
ClassDB::bind_method(D_METHOD("get_customizable_slot_entry_count", "slot_index"), &SpeciesModelData::get_customizable_slot_entry_count);
ClassDB::bind_method(D_METHOD("get_customizable_slot_entries", "slot_index"), &SpeciesModelData::get_customizable_slot_entries);
ClassDB::bind_method(D_METHOD("set_customizable_slot_entries", "slot_index", "customizable_slots"), &SpeciesModelData::set_customizable_slot_entries);
//Color Slots
ClassDB::bind_method(D_METHOD("get_customizable_color_slots_string"), &SpeciesModelData::get_customizable_color_slots_string);
ClassDB::bind_method(D_METHOD("set_customizable_color_slots_string", "value"), &SpeciesModelData::set_customizable_color_slots_string);
ADD_PROPERTY(PropertyInfo(Variant::STRING, "customizable_color_slots_string"), "set_customizable_color_slots_string", "get_customizable_color_slots_string");
ClassDB::bind_method(D_METHOD("get_color_customizable_slot_color", "slot_index", "index"), &SpeciesModelData::get_color_customizable_slot_color);
ClassDB::bind_method(D_METHOD("set_color_customizable_slot_color", "slot_index", "index", "data"), &SpeciesModelData::set_color_customizable_slot_color);
ClassDB::bind_method(D_METHOD("add_color_customizable_slot_color", "slot_index", "color_customizable_slot"), &SpeciesModelData::add_color_customizable_slot_color);
ClassDB::bind_method(D_METHOD("remove_color_customizable_slot_color", "slot_index", "index"), &SpeciesModelData::remove_color_customizable_slot_color);
ClassDB::bind_method(D_METHOD("get_color_customizable_slot_colors", "slot_index"), &SpeciesModelData::get_color_customizable_slot_colors);
ClassDB::bind_method(D_METHOD("set_color_customizable_slot_colors", "slot_index", "colors"), &SpeciesModelData::set_color_customizable_slot_colors);
ClassDB::bind_method(D_METHOD("get_color_customizable_slot_bone_slot_mask", "slot_index"), &SpeciesModelData::get_color_customizable_slot_bone_slot_mask);
ClassDB::bind_method(D_METHOD("set_color_customizable_slot_bone_slot_mask", "slot_index", "value"), &SpeciesModelData::set_color_customizable_slot_bone_slot_mask);
ClassDB::bind_method(D_METHOD("get_color_customizable_slot_texture_layer", "slot_index"), &SpeciesModelData::get_color_customizable_slot_texture_layer);
ClassDB::bind_method(D_METHOD("set_color_customizable_slot_texture_layer", "slot_index", "value"), &SpeciesModelData::set_color_customizable_slot_texture_layer);
ClassDB::bind_method(D_METHOD("get_color_customizable_count"), &SpeciesModelData::get_color_customizable_count);
ClassDB::bind_method(D_METHOD("get_color_customizable_slot_count", "slot_index"), &SpeciesModelData::get_color_customizable_slot_count);
}
================================================
FILE: data/species/species_model_data.h
================================================
/*
Copyright (c) 2019-2022 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.
*/
#ifndef SPECIES_MODEL_DATA_H
#define SPECIES_MODEL_DATA_H
#include "core/version.h"
#include "core/io/resource.h"
#include "core/templates/vector.h"
#include "core/string/ustring.h"
#include "core/math/color.h"
#include "scene/resources/packed_scene.h"
#include "../items/model_visual_entry.h"
#include "../../entity_enums.h"
class ModelVisual;
class SpeciesModelData : public Resource {
GDCLASS(SpeciesModelData, Resource);
public:
int get_id();
void set_id(int value);
int get_bone_structure() const;
void set_bone_structure(const int value);
Ref<PackedScene> get_body();
void set_body(Ref<PackedScene> value);
//Entries
Ref<ModelVisualEntry> get_visual(const int index) const;
void set_visual(const int index, const Ref<ModelVisualEntry> visual);
void add_visual(const Ref<ModelVisualEntry> &visual);
void remove_visual(const int index);
int get_visual_count() const;
Vector<Variant> get_visuals();
void set_visuals(const Vector<Variant> &visuals);
//Customizable Slots
String get_customizable_slots_string() const;
void set_customizable_slots_string(const String &value);
Ref<ModelVisualEntry> get_customizable_slot_entry(const int slot_index, const int index) const;
void set_customizable_slot_entry(const int slot_index, const int index, const Ref<ModelVisualEntry> customizable_slot);
void add_customizable_slot_entry(const int slot_index, const Ref<ModelVisualEntry> customizable_slot);
void remove_customizable_slot_entry(const int slot_index, const int index);
int get_customizable_slot_count() const;
int get_customizable_slot_entry_count(const int slot_index) const;
Vector<Variant> get_customizable_slot_entries(const int slot_index) const;
void set_customizable_slot_entries(const int slot_index, const Vector<Variant> &customizable_slots);
//Color Customizable Slots
String get_customizable_color_slots_string() const;
void set_customizable_color_slots_string(const String &value);
Color get_color_customizable_slot_color(const int slot_index, const int index) const;
void set_color_customizable_slot_color(const int slot_index, const int index, const Color color_customizable_slot);
void add_color_customizable_slot_color(const int slot_index, const Color color_customizable_slot);
void remove_color_customizable_slot_color(const int slot_index, const int index);
Vector<Color> get_color_customizable_slot_colors(const int slot_index) const;
void set_color_customizable_slot_colors(const int slot_index, const Vector<Color> &colors);
uint64_t get_color_customizable_slot_bone_slot_mask(const int slot_index) const;
void set_color_customizable_slot_bone_slot_mask(const int slot_index, const uint64_t value);
int get_color_customizable_slot_texture_layer(const int slot_index) const;
void set_color_customizable_slot_texture_layer(const int slot_index, const int value);
int get_color_customizable_count() const;
int get_color_customizable_slot_count(const int slot_index) const;
SpeciesModelData();
~SpeciesModelData();
protected:
bool _set(const StringName &p_name, const Variant &p_value);
bool _get(const StringName &p_name, Variant &r_ret) const;
void _get_property_list(List<PropertyInfo> *p_list) const;
void _validate_property(PropertyInfo &property) const;
static void _bind_methods();
protected:
struct ColorSlotData {
int texture_layer;
uint64_t bone_slot_mask;
Vector<Color> colors;
};
private:
int _id;
int _bone_structure;
Ref<PackedScene> _body;
String _customizable_slots_string;
String _customizable_color_slots_string;
Vector<Ref<ModelVisualEntry> > _visuals;
Vector<Vector<Ref<ModelVisualEntry> > > _customizable_slots;
Vector<ColorSlotData> _customizable_color_slots;
};
#endif
================================================
FILE: data/spells/spell.cpp
================================================
/*
Copyright (c) 2019-2022 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.
*/
#include "spell.h"
#include "../../entities/auras/aura_data.h"
#include "../../entities/resources/entity_resource_cost_data.h"
#include "../../entities/skills/entity_skill_data.h"
#include "../items/craft_recipe.h"
#include "../../entities/auras/aura_data.h"
#include "../../entities/data/entity_data.h"
#include "../../infos/aura_infos.h"
#include "../auras/aura_group.h"
#include "../../singletons/ess.h"
#include "../../pipelines/spell_damage_info.h"
#include "../../pipelines/spell_heal_info.h"
#include "../../defines.h"
int Spell::get_id() const {
return _id;
}
void Spell::set_id(const int value) {
_id = value;
}
int Spell::spell_type_get() const {
return _spell_type;
}
void Spell::spell_type_set(int value) {
_spell_type = value;
}
SpellEnums::SpellCategory Spell::get_spell_category() const {
return _spell_category;
}
void Spell::set_spell_category(SpellEnums::SpellCategory value) {
_spell_category = value;
}
bool Spell::get_hide_from_actionbar() const {
return _hide_from_actionbar;
}
void Spell::set_hide_from_actionbar(const bool value) {
_hide_from_actionbar = value;
}
float Spell::get_cooldown() const {
return _cooldown;
}
void Spell::set_cooldown(const float value) {
_cooldown = value;
}
SpellTargetType Spell::get_target_type() const {
return _target_type;
}
void Spell::set_target_type(const SpellTargetType value) {
_target_type = value;
}
TargetRelationType Spell::get_target_relation_type() const {
return _target_relation_type;
}
void Spell::set_target_relation_type(const TargetRelationType value) {
_target_relation_type = value;
}
int Spell::get_level() const {
return _level;
}
void Spell::set_level(const int value) {
_level = value;
}
int Spell::get_rank() const {
return _rank;
}
void Spell::set_rank(const int value) {
_rank = value;
}
bool Spell::get_scale_with_level() const {
return _scale_with_level;
}
void Spell::set_scale_with_level(const bool value) {
_scale_with_level = value;
}
Ref<ItemTemplate> Spell::get_item_cost() {
return _item_cost;
}
void Spell::set_item_cost(const Ref<ItemTemplate> &value) {
_item_cost = value;
}
Ref<ItemTemplate> Spell::get_required_item() {
return _required_item;
}
void Spell::set_required_item(const Ref<ItemTemplate> &value) {
_required_item = value;
}
Ref<EntityResourceCostData> Spell::get_resource_cost() {
return _resource_cost;
}
void Spell::set_resource_cost(const Ref<EntityResourceCostData> &value) {
_resource_cost = value;
}
Ref<EntityResourceCostData> Spell::get_resource_give() {
return _resource_give;
}
void Spell::set_resource_give(const Ref<EntityResourceCostData> &value) {
_resource_give = value;
}
bool Spell::get_global_cooldown_enabled() const {
return _global_cooldown_enabled;
}
void Spell::set_global_cooldown_enabled(const bool value) {
_global_cooldown_enabled = value;
}
bool Spell::get_is_local_spell() const {
return _is_local_spell;
}
void Spell::set_is_local_spell(const bool value) {
_is_local_spell = value;
}
Ref<Texture> Spell::get_icon() {
return _icon;
}
void Spell::set_icon(const Ref<Texture> &value) {
_icon = Ref<Texture>(value);
}
String Spell::get_text_translation_key() const {
return _text_translation_key;
}
void Spell::set_text_translation_key(const String &value) {
_text_translation_key = value;
}
String Spell::get_text_description() const {
return _text_description;
}
void Spell::set_text_description(const String &value) {
_text_description = value;
}
Ref<SpellEffectVisual> Spell::get_visual_spell_effects() {
return _visual_spell_effects;
}
void Spell::set_visual_spell_effects(const Ref<SpellEffectVisual> &value) {
_visual_spell_effects = value;
}
Ref<CraftRecipe> Spell::get_teaches_craft_recipe() {
return _teaches_craft_recipe;
}
void Spell::set_teaches_craft_recipe(const Ref<CraftRecipe> &value) {
_teaches_craft_recipe = value;
}
//// Caster Aura Apply ////
int Spell::spells_cast_on_caster_num_get() const {
return _spells_cast_on_caster.size();
}
void Spell::spells_cast_on_caster_num_set(const int value) {
_spells_cast_on_caster.resize(value);
}
Ref<Spell> Spell::spell_cast_on_caster_get(const int index) {
ERR_FAIL_INDEX_V(index, _spells_cast_on_caster.size(), Ref<Spell>());
return _spells_cast_on_caster[index];
}
void Spell::spell_cast_on_caster_set(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _spells_cast_on_caster.size());
_spells_cast_on_caster.set(index, Ref<Spell>(spell));
}
Vector<Variant> Spell::spells_cast_on_caster_get() {
VARIANT_ARRAY_GET(_spells_cast_on_caster);
}
void Spell::spells_cast_on_caster_set(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _spells_cast_on_caster, Spell);
}
//// Target Aura Apply ////
int Spell::spells_cast_on_target_num_get() const {
return _spells_cast_on_target.size();
}
void Spell::spells_cast_on_target_num_set(const int value) {
_spells_cast_on_target.resize(value);
}
Ref<Spell> Spell::spell_cast_on_target_get(const int index) {
ERR_FAIL_INDEX_V(index, _spells_cast_on_target.size(), Ref<Spell>());
return _spells_cast_on_target[index];
}
void Spell::spell_cast_on_target_set(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _spells_cast_on_target.size());
_spells_cast_on_target.set(index, Ref<Spell>(spell));
}
Vector<Variant> Spell::spells_cast_on_target_get() {
VARIANT_ARRAY_GET(_spells_cast_on_target);
}
void Spell::spells_cast_on_target_set(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _spells_cast_on_target, Spell);
}
//// Apply Auras On Learn ////
int Spell::on_learn_cast_spells_num_get() const {
return _on_learn_cast_spells.size();
}
void Spell::on_learn_cast_spells_num_set(const int value) {
_on_learn_cast_spells.resize(value);
}
Ref<Spell> Spell::spell_cast_on_learn_get(int index) {
ERR_FAIL_INDEX_V(index, _on_learn_cast_spells.size(), Ref<Spell>());
return _on_learn_cast_spells[index];
}
void Spell::spell_cast_on_learn_set(const int index, const Ref<Spell> &spell) {
ERR_FAIL_INDEX(index, _on_learn_cast_spells.size());
_on_learn_cast_spells.set(index, Ref<Spell>(spell));
}
Vector<Variant> Spell::spells_cast_on_learn_get() {
VARIANT_ARRAY_GET(_on_learn_cast_spells);
}
void Spell::spells_cast_on_learn_set(const Vector<Variant> &spells) {
VARIANT_ARRAY_SET(spells, _on_learn_cast_spells, Spell);
}
//// Range ////
bool Spell::range_get_enabled() const {
return _range_enabled;
}
void Spell::range_set_enabled(const bool value) {
_range_enabled = value;
}
float Spell::range_get() const {
return _range;
}
void Spell::range_set(const float value) {
_range = value;
}
bool Spell::cast_time_get_enabled() const {
return _cast_time_enabled;
}
void Spell::cast_time_set_enabled(const bool value) {
_cast_time_enabled = value;
}
float Spell::cast_time_get() const {
return _cast_time;
}
void Spell::cast_time_set(const float value) {
_cast_time = value;
}
bool Spell::projectile_get_use_time() const {
return _projectile_use_time;
}
void Spell::projectile_set_use_time(const bool value) {
_projectile_use_time = value;
}
float Spell::projectile_get_time() const {
return _projectile_time;
}
void Spell::projectile_set_time(const float value) {
_projectile_time = value;
}
bool Spell::projectile_get_use_speed() const {
return _projectile_use_speed;
}
void Spell::projectile_set_use_speed(const bool value) {
_projectile_use_speed = value;
}
float Spell::projectile_get_speed() const {
return _projectile_speed;
}
void Spell::projectile_set_speed(const float value) {
_projectile_speed = value;
}
Ref<PackedScene> Spell::projectile_get_scene() const {
return _projectile_scene;
}
void Spell::projectile_set_scene(const Ref<PackedScene> &value) {
_projectile_scene = value;
}
bool Spell::damage_get_enabled() const {
return _damage_enabled;
}
void Spell::damage_set_enabled(const bool value) {
_damage_enabled = value;
}
int Spell::damage_get_type() const {
return _damage_type;
}
void Spell::damage_set_type(const int value) {
_damage_type = value;
}
int Spell::damage_get_min() const {
return _damage_min;
}
void Spell::damage_set_min(const int value) {
_damage_min = value;
}
int Spell::damage_get_max() const {
return _damage_max;
}
void Spell::damage_set_max(const int value) {
_damage_max = value;
}
int Spell::damage_get_scale_stat() const {
return _damage_scale_stat;
}
void Spell::damage_set_scale_stat(const int value) {
_damage_scale_stat = value;
}
float Spell::damage_get_scale_coeff() const {
return _damage_scale_coeff;
}
void Spell::damage_set_scale_coeff(const float value) {
_damage_scale_coeff = value;
}
bool Spell::heal_get_enabled() const {
return _heal_enabled;
}
void Spell::heal_set_enabled(const bool value) {
_heal_enabled = value;
}
int Spell::heal_get_min() const {
return _heal_min;
}
void Spell::heal_set_min(const int value) {
_heal_min = value;
}
int Spell::heal_get_max() const {
return _heal_max;
}
void Spell::heal_set_max(const int value) {
_heal_max = value;
}
int Spell::heal_get_scale_stat() const {
return _heal_scale_stat;
}
void Spell::heal_set_scale_stat(const int value) {
_heal_scale_stat = value;
}
float Spell::heal_get_scale_coeff() const {
return _heal_scale_coeff;
}
void Spell::heal_set_scale_coeff(const float value) {
_heal_scale_coeff = value;
}
bool Spell::dispell_get_enabled() const {
return _dispell_enabled;
}
void Spell::dispell_set_enabled(const bool value) {
_dispell_enabled = value;
}
int Spell::dispell_get_count_min() const {
return _dispell_count_min;
}
void Spell::dispell_set_count_min(const int value) {
_dispell_count_min = value;
}
int Spell::dispell_get_count_max() const {
return _dispell_count_max;
}
void Spell::dispell_set_count_max(const int value) {
_dispell_count_max = value;
}
int Spell::dispell_get_aura_types() const {
return _dispell_aura_types;
}
void Spell::dispell_set_aura_types(const int value) {
_dispell_aura_types = value;
}
bool Spell::get_needs_target() const {
return _needs_target;
}
void Spell::set_needs_target(const bool value) {
_needs_target = value;
}
bool Spell::get_can_move_while_casting() const {
return _can_move_while_casting;
}
void Spell::set_can_move_while_casting(const bool value) {
_can_move_while_casting = value;
}
bool Spell::get_interrupt_enabled() const {
return _interrupt_enabled;
}
void Spell::set_interrupt_enabled(const bool value) {
_interrupt_enabled = value;
}
float Spell::get_interrupt_time() const {
return _interrupt_time;
}
void Spell::set_interrupt_time(const float value) {
_interrupt_time = value;
}
bool Spell::get_is_aoe() const {
return _is_aoe;
}
void Spell::set_is_aoe(const bool value) {
_is_aoe = value;
}
SpellAOETargetType Spell::get_aoe_target_type() const {
return _aoe_targetType;
}
void Spell::set_aoe_target_type(const SpellAOETargetType value) {
_aoe_targetType = value;
}
SpellEnums::ColliderType Spell::get_aoe_collider_type() const {
return _aoe_colliderType;
}
void Spell::set_aoe_collider_type(const SpellEnums::ColliderType value) {
_aoe_colliderType = value;
}
float Spell::get_aoe_radius() const {
return _aoe_radius;
}
void Spell::set_aoe_radius(float value) {
_aoe_radius = value;
}
Vector3 Spell::get_aoe_box_extents() const {
return _aoe_box_extents;
}
void Spell::set_aoe_box_extents(Vector3 value) {
_aoe_box_extents = value;
}
int Spell::get_spell_cooldown_mainpulation_data_count() const {
return _spell_cooldown_mainpulation_data_count;
}
void Spell::set_spell_cooldown_mainpulation_data_count(int value) {
_spell_cooldown_mainpulation_data_count = value;
}
int Spell::get_training_cost() const {
return _training_cost;
}
void Spell::set_training_cost(const int value) {
_training_cost = value;
}
Ref<Spell> Spell::get_training_required_spell() {
return _training_required_spell;
}
void Spell::set_training_required_spell(const Ref<Spell> &spell) {
_training_required_spell = spell;
}
Ref<EntitySkillData> Spell::get_training_required_skill() {
return _training_required_skill;
}
void Spell::set_training_required_skill(const Ref<EntitySkillData> &skill) {
_training_required_skill = skill;
}
int Spell::get_training_required_skill_level() const {
return _training_required_skill_level;
}
void Spell::set_training_required_skill_level(const int value) {
_training_required_skill_level = value;
}
// Aura
bool Spell::aura_get_permanent() const {
return _aura_permanent;
}
void Spell::aura_set_permanent(const bool value) {
_aura_permanent = value;
}
float Spell::aura_get_time() const {
return _aura_time;
}
void Spell::aura_set_time(const float value) {
_aura_time = value;
}
float Spell::aura_get_tick() const {
return _aura_tick;
}
void Spell::aura_set_tick(const float value) {
_aura_tick = value;
}
Ref<AuraGroup> Spell::aura_get_aura_group() {
return _aura_group;
}
void Spell::aura_set_aura_group(const Ref<AuraGroup> &value) {
_aura_group = value;
}
bool Spell::aura_get_is_debuff() const {
return _aura_is_debuff;
}
void Spell::aura_set_is_debuff(const bool value) {
_aura_is_debuff = value;
}
SpellEnums::AuraType Spell::aura_get_aura_type() const {
return _aura_type;
}
void Spell::aura_set_aura_type(SpellEnums::AuraType value) {
_aura_type = value;
}
bool Spell::aura_get_scale_with_level() const {
return _aura_scale_with_level;
}
void Spell::aura_set_scale_with_level(const bool value) {
_aura_scale_with_level = value;
}
String Spell::aura_get_text_translation_key() const {
return _aura_text_translation_key;
}
void Spell::aura_set_text_translation_key(const String &value) {
_aura_text_translation_key = value;
}
String Spell::aura_get_text_description() const {
return _aura_text_description;
}
void Spell::aura_set_text_description(const String description) {
_aura_text_description = description;
}
bool Spell::aura_get_hide() const {
return _aura_hide;
}
void Spell::aura_set_hide(const bool value) {
_aura_hide = value;
}
Ref<SpellEffectVisual> Spell::aura_get_visual_spell_effects() {
return _aura_visual_spell_effects;
}
void Spell::aura_set_visual_spell_effects(const Ref<SpellEffectVisual> &value) {
_aura_visual_spell_effects = value;
}
int Spell::aura_get_ability_scale_data_id() const {
return _aura_ability_scale_data_id;
}
void Spell::aura_set_ability_scale_data_id(const int value) {
_aura_ability_scale_data_id = value;
}
float Spell::aura_damage_get_scale_for_level(const int level) const {
//return this->getDamageLevelScaling()->Evaluate((float)(level));
return 1;
}
float Spell::aura_heal_get_scale_for_level(const int level) const {
//return this->getHealLevelScaling()->Evaluate((float)(level));
return 1;
}
float Spell::aura_absorb_get_scale_for_level(const int level) const {
//return this->getAbsorbLevelScaling()->Evaluate((float)(level));
return 1;
}
bool Spell::aura_diminishing_return_enabled_get() const {
return _aura_diminishing_return_enabled;
}
void Spell::aura_diminishing_return_enabled_set(const bool value) {
_aura_diminishing_return_enabled = value;
}
int Spell::aura_diminishing_return_category_get() const {
return _aura_diminishing_return_category;
}
void Spell::aura_diminishing_return_category_set(const int value) {
_aura_diminishing_return_category = value;
}
Ref<Spell> Spell::aura_get_teaches_spell() {
return _aura_teaches_spell;
}
void Spell::aura_set_teaches_spell(const Ref<Spell> &spell) {
_aura_teaches_spell = spell;
}
/*
void Spell::SetScalingData(AbilityScalingData *scalingData) {
scalingData->getDamageCurve();
scalingData->getAbsorbCurve();
scalingData->getHealingCurve();
}*/
/*
void Spell::OnAuraAbilityScalingDataLoaded(AbilityScalingDataLoaderHelper *h) {
this->SetScalingData(h->getData());
}
*/
//Damage
bool Spell::aura_damage_get_enabled() const {
return _aura_damage_enabled;
}
void Spell::aura_damage_set_enabled(const bool value) {
_aura_damage_enabled = value;
}
int Spell::aura_damage_get_type() const {
return _aura_damage_type;
}
void Spell::aura_damage_set_type(const int value) {
_aura_damage_type = value;
}
int Spell::aura_damage_get_min() const {
return _aura_damage_min;
}
void Spell::aura_damage_set_min(const int value) {
_aura_damage_min = value;
}
int Spell::aura_damage_get_max() const {
return _aura_damage_max;
}
void Spell::aura_damage_set_max(const int value) {
_aura_damage_max = value;
}
bool Spell::aura_damage_get_can_crit() const {
return _aura_damage_can_crit;
}
void Spell::aura_damage_set_can_crit(const bool value) {
_aura_damage_can_crit = value;
}
void Spell::aura_damage_set(const int min, const int max, const bool can_crit) {
aura_damage_set_enabled(true);
aura_damage_set_min(min);
aura_damage_set_max(max);
aura_damage_set_can_crit(can_crit);
}
//Absorb
bool Spell::aura_absorb_get_enabled() const {
return _aura_absorb_enabled;
}
void Spell::aura_absorb_set_enabled(const bool value) {
_aura_absorb_enabled = value;
}
int Spell::aura_absorb_damage_get_type() const {
return _aura_absorb_damage_type;
}
void Spell::aura_absorb_damage_set_type(const int value) {
_aura_absorb_damage_type = value;
}
int Spell::aura_absorb_get_min() const {
return _aura_absorb_min;
}
void Spell::aura_absorb_set_min(const int value) {
_aura_absorb_min = value;
}
int Spell::aura_absorb_get_max() const {
return _aura_absorb_max;
}
void Spell::aura_absorb_set_max(const int value) {
_aura_absorb_max = value;
}
//Heal
bool Spell::aura_heal_get_enabled() const {
return _aura_heal_enabled;
}
void Spell::aura_heal_set_enabled(const bool value) {
_aura_heal_enabled = value;
}
int Spell::aura_heal_get_min() const {
return _aura_heal_min;
}
void Spell::aura_heal_set_min(const int value) {
_aura_heal_min = value;
}
int Spell::aura_heal_get_max() const {
return _aura_heal_max;
}
void Spell::aura_heal_set_max(const int value) {
_aura_heal_max = value;
}
bool Spell::aura_h
gitextract_12vn9isv/
├── .gitignore
├── LICENSE
├── README.md
├── SCsub
├── config.py
├── data/
│ ├── atlases/
│ │ ├── character_atlas.cpp
│ │ ├── character_atlas.h
│ │ ├── character_atlas_entry.cpp
│ │ └── character_atlas_entry.h
│ ├── auras/
│ │ ├── aura_group.cpp
│ │ └── aura_group.h
│ ├── items/
│ │ ├── craft_recipe.cpp
│ │ ├── craft_recipe.h
│ │ ├── craft_recipe_helper.cpp
│ │ ├── craft_recipe_helper.h
│ │ ├── equipment_data.cpp
│ │ ├── equipment_data.h
│ │ ├── item_instance.cpp
│ │ ├── item_instance.h
│ │ ├── item_template.cpp
│ │ ├── item_template.h
│ │ ├── model_visual.cpp
│ │ ├── model_visual.h
│ │ ├── model_visual_entry.cpp
│ │ └── model_visual_entry.h
│ ├── loot/
│ │ ├── loot_data_base.cpp
│ │ └── loot_data_base.h
│ ├── species/
│ │ ├── entity_species_data.cpp
│ │ ├── entity_species_data.h
│ │ ├── species_instance.cpp
│ │ ├── species_instance.h
│ │ ├── species_model_data.cpp
│ │ └── species_model_data.h
│ └── spells/
│ ├── spell.cpp
│ ├── spell.h
│ ├── spell_cooldown_manipulation_data.cpp
│ ├── spell_cooldown_manipulation_data.h
│ ├── spell_effect_visual.cpp
│ ├── spell_effect_visual.h
│ ├── spell_effect_visual_simple.cpp
│ └── spell_effect_visual_simple.h
├── database/
│ ├── ess_resource_db.cpp
│ ├── ess_resource_db.h
│ ├── ess_resource_db_folders.cpp
│ ├── ess_resource_db_folders.h
│ ├── ess_resource_db_map.cpp
│ ├── ess_resource_db_map.h
│ ├── ess_resource_db_static.cpp
│ └── ess_resource_db_static.h
├── defines.h
├── doc_classes/
│ ├── AIFormation.xml
│ ├── ActionBarButtonEntry.xml
│ ├── ActionBarEntry.xml
│ ├── ActionBarProfile.xml
│ ├── AuraApplyInfo.xml
│ ├── AuraData.xml
│ ├── AuraGroup.xml
│ ├── Bag.xml
│ ├── CharacterAtlas.xml
│ ├── CharacterAtlasEntry.xml
│ ├── CharacterBones.xml
│ ├── CharacterSkeleton2D.xml
│ ├── CharacterSkeleton3D.xml
│ ├── CharacterSpec.xml
│ ├── ClassProfile.xml
│ ├── ComplexLevelStatData.xml
│ ├── CraftRecipe.xml
│ ├── CraftRecipeHelper.xml
│ ├── ESDragAndDrop.xml
│ ├── ESS.xml
│ ├── ESSEntitySpawner.xml
│ ├── ESSMaterialCache.xml
│ ├── ESSMaterialCachePCM.xml
│ ├── ESSResourceDB.xml
│ ├── ESSResourceDBFolders.xml
│ ├── ESSResourceDBMap.xml
│ ├── ESSResourceDBStatic.xml
│ ├── Entity.xml
│ ├── EntityAI.xml
│ ├── EntityClassData.xml
│ ├── EntityCreateInfo.xml
│ ├── EntityData.xml
│ ├── EntityDataContainer.xml
│ ├── EntityEnums.xml
│ ├── EntityResource.xml
│ ├── EntityResourceCostData.xml
│ ├── EntityResourceCostDataHealth.xml
│ ├── EntityResourceCostDataResource.xml
│ ├── EntityResourceHealth.xml
│ ├── EntityResourceSpeed.xml
│ ├── EntitySkill.xml
│ ├── EntitySkillData.xml
│ ├── EntitySpeciesData.xml
│ ├── EquipmentData.xml
│ ├── InputProfile.xml
│ ├── InputProfileModifier.xml
│ ├── InputProfileModifierEntry.xml
│ ├── ItemContainerData.xml
│ ├── ItemContainerDataEntry.xml
│ ├── ItemEnums.xml
│ ├── ItemInstance.xml
│ ├── ItemTemplate.xml
│ ├── LevelStatData.xml
│ ├── LootDataBase.xml
│ ├── ModelVisual.xml
│ ├── ModelVisualEntry.xml
│ ├── PlayerProfile.xml
│ ├── ProfileManager.xml
│ ├── PropDataEntity.xml
│ ├── SimpleLevelStatData.xml
│ ├── SkeletonModelEntry.xml
│ ├── SpeciesInstance.xml
│ ├── SpeciesModelData.xml
│ ├── Spell.xml
│ ├── SpellCastInfo.xml
│ ├── SpellCooldownManipulationData.xml
│ ├── SpellDamageInfo.xml
│ ├── SpellEffectVisual.xml
│ ├── SpellEffectVisualSimple.xml
│ ├── SpellEnums.xml
│ ├── SpellFollowProjectile3D.xml
│ ├── SpellHealInfo.xml
│ ├── StatData.xml
│ ├── VendorItemData.xml
│ └── VendorItemDataEntry.xml
├── drag_and_drop/
│ ├── es_drag_and_drop.cpp
│ └── es_drag_and_drop.h
├── editor/
│ ├── ess_editor_plugin.cpp
│ └── ess_editor_plugin.h
├── entities/
│ ├── ai/
│ │ ├── entity_ai.cpp
│ │ └── entity_ai.h
│ ├── auras/
│ │ ├── aura_data.cpp
│ │ └── aura_data.h
│ ├── data/
│ │ ├── character_spec.cpp
│ │ ├── character_spec.h
│ │ ├── entity_class_data.cpp
│ │ ├── entity_class_data.h
│ │ ├── entity_data.cpp
│ │ ├── entity_data.h
│ │ ├── entity_data_container.cpp
│ │ ├── entity_data_container.h
│ │ ├── item_container_data.cpp
│ │ ├── item_container_data.h
│ │ ├── item_container_data_entry.cpp
│ │ ├── item_container_data_entry.h
│ │ ├── vendor_item_data.cpp
│ │ ├── vendor_item_data.h
│ │ ├── vendor_item_data_entry.cpp
│ │ └── vendor_item_data_entry.h
│ ├── entity.cpp
│ ├── entity.h
│ ├── resources/
│ │ ├── entity_resource.cpp
│ │ ├── entity_resource.h
│ │ ├── entity_resource_cost_data.cpp
│ │ ├── entity_resource_cost_data.h
│ │ ├── entity_resource_cost_data_health.cpp
│ │ ├── entity_resource_cost_data_health.h
│ │ ├── entity_resource_cost_data_resource.cpp
│ │ ├── entity_resource_cost_data_resource.h
│ │ ├── entity_resource_health.cpp
│ │ ├── entity_resource_health.h
│ │ ├── entity_resource_speed.cpp
│ │ └── entity_resource_speed.h
│ ├── skills/
│ │ ├── entity_skill.cpp
│ │ ├── entity_skill.h
│ │ ├── entity_skill_data.cpp
│ │ └── entity_skill_data.h
│ └── stats/
│ ├── complex_level_stat_data.cpp
│ ├── complex_level_stat_data.h
│ ├── level_stat_data.cpp
│ ├── level_stat_data.h
│ ├── simple_level_stat_data.cpp
│ ├── simple_level_stat_data.h
│ ├── stat_data.cpp
│ └── stat_data.h
├── entity_enums.cpp
├── entity_enums.h
├── formations/
│ ├── ai_formation.cpp
│ └── ai_formation.h
├── infos/
│ ├── aura_infos.cpp
│ ├── aura_infos.h
│ ├── spell_cast_info.cpp
│ └── spell_cast_info.h
├── inventory/
│ ├── bag.cpp
│ ├── bag.h
│ ├── grid_bag.cpp
│ ├── grid_bag.h
│ ├── inventory.cpp
│ ├── inventory.h
│ ├── normal_bag.cpp
│ └── normal_bag.h
├── item_enums.cpp
├── item_enums.h
├── material_cache/
│ ├── ess_material_cache.cpp
│ ├── ess_material_cache.h
│ ├── ess_material_cache_pcm.cpp
│ └── ess_material_cache_pcm.h
├── pipelines/
│ ├── spell_damage_info.cpp
│ ├── spell_damage_info.h
│ ├── spell_heal_info.cpp
│ └── spell_heal_info.h
├── profiles/
│ ├── actionbar/
│ │ ├── action_bar_button_entry.cpp
│ │ ├── action_bar_button_entry.h
│ │ ├── action_bar_entry.cpp
│ │ ├── action_bar_entry.h
│ │ ├── action_bar_profile.cpp
│ │ └── action_bar_profile.h
│ ├── class_profile.cpp
│ ├── class_profile.h
│ ├── input/
│ │ ├── input_profile.cpp
│ │ ├── input_profile.h
│ │ ├── input_profile_modifier.cpp
│ │ ├── input_profile_modifier.h
│ │ ├── input_profile_modifier_entry.cpp
│ │ └── input_profile_modifier_entry.h
│ ├── player_profile.cpp
│ └── player_profile.h
├── projectiles/
│ └── 3d/
│ ├── spell_follow_projectile_3d.cpp
│ └── spell_follow_projectile_3d.h
├── props/
│ ├── prop_data_entity.cpp
│ └── prop_data_entity.h
├── register_types.cpp
├── register_types.h
├── singletons/
│ ├── ess.cpp
│ ├── ess.h
│ ├── profile_manager.cpp
│ └── profile_manager.h
├── skeleton/
│ ├── character_bones.cpp
│ ├── character_bones.h
│ ├── character_skeleton_2d.cpp
│ ├── character_skeleton_2d.h
│ ├── character_skeleton_3d.cpp
│ ├── character_skeleton_3d.h
│ ├── entity_skeleton_data.cpp
│ ├── entity_skeleton_data.h
│ ├── skeleton_model_entry.cpp
│ └── skeleton_model_entry.h
├── spawners/
│ ├── ess_entity_spawner.cpp
│ └── ess_entity_spawner.h
├── spell_enums.cpp
├── spell_enums.h
└── utility/
├── entity_create_info.cpp
└── entity_create_info.h
SYMBOL INDEX (293 symbols across 128 files)
FILE: config.py
function can_build (line 3) | def can_build(env, platform):
function configure (line 7) | def configure(env):
function get_doc_classes (line 11) | def get_doc_classes():
function get_doc_path (line 110) | def get_doc_path():
FILE: data/atlases/character_atlas.h
function class (line 31) | class CharacterAtlas : public Resource {
FILE: data/atlases/character_atlas_entry.h
function class (line 31) | class CharacterAtlasEntry : public Resource {
FILE: data/auras/aura_group.h
function class (line 31) | class AuraGroup : public Resource {
FILE: data/items/craft_recipe.h
type CraftCategories (line 44) | enum CraftCategories {
type CraftSubCategories (line 53) | enum CraftSubCategories {
FILE: data/items/craft_recipe_helper.h
function class (line 33) | class CraftRecipeHelper : public Resource {
FILE: data/items/equipment_data.h
function class (line 34) | class EquipmentData : public Resource {
FILE: data/items/item_instance.cpp
function String (line 160) | String ItemInstance::get_description() {
function Dictionary (line 167) | Dictionary ItemInstance::to_dict() {
function Dictionary (line 174) | Dictionary ItemInstance::_to_dict() {
FILE: data/items/item_instance.h
type ItemStatModifier (line 86) | struct ItemStatModifier {
FILE: data/items/item_template.cpp
function String (line 152) | String ItemTemplate::get_text_translation_key() const {
function String (line 389) | String ItemTemplate::get_description() {
FILE: data/items/item_template.h
function class (line 41) | class ItemTemplate : public Resource {
FILE: data/items/model_visual.h
function class (line 34) | class ModelVisual : public Resource {
FILE: data/items/model_visual_entry.cpp
function Color (line 88) | Color ModelVisualEntry::get_color(const int index) const {
function Transform3D (line 109) | Transform3D ModelVisualEntry::get_transform(const int index) const {
FILE: data/items/model_visual_entry.h
type ModenVisualEntryType (line 49) | enum ModenVisualEntryType {
type MVEE (line 96) | struct MVEE {
FILE: data/loot/loot_data_base.cpp
function Array (line 93) | Array LootDataBase::get_loot() {
function Array (line 97) | Array LootDataBase::_get_loot() {
FILE: data/loot/loot_data_base.h
type LootDBItem (line 72) | struct LootDBItem {
FILE: data/species/entity_species_data.cpp
function String (line 45) | String EntitySpeciesData::get_text_description() const {
function String (line 153) | String EntitySpeciesData::generate_name(int seed) {
FILE: data/species/entity_species_data.h
function class (line 39) | class EntitySpeciesData : public Resource {
FILE: data/species/species_instance.cpp
function StringName (line 48) | StringName SpeciesInstance::get_species_path() const {
function Dictionary (line 98) | Dictionary SpeciesInstance::to_dict() {
function Dictionary (line 105) | Dictionary SpeciesInstance::_to_dict() {
FILE: data/species/species_instance.h
function class (line 35) | class SpeciesInstance : public Resource {
FILE: data/species/species_model_data.cpp
function String (line 88) | String SpeciesModelData::get_customizable_slots_string() const {
function String (line 161) | String SpeciesModelData::get_customizable_color_slots_string() const {
function Color (line 175) | Color SpeciesModelData::get_color_customizable_slot_color(const int slot...
FILE: data/species/species_model_data.h
function class (line 42) | class SpeciesModelData : public Resource {
FILE: data/spells/spell.cpp
function SpellTargetType (line 77) | SpellTargetType Spell::get_target_type() const {
function TargetRelationType (line 84) | TargetRelationType Spell::get_target_relation_type() const {
function String (line 161) | String Spell::get_text_translation_key() const {
function String (line 168) | String Spell::get_text_description() const {
function SpellAOETargetType (line 475) | SpellAOETargetType Spell::get_aoe_target_type() const {
function Vector3 (line 496) | Vector3 Spell::get_aoe_box_extents() const {
function String (line 589) | String Spell::aura_get_text_translation_key() const {
function String (line 596) | String Spell::aura_get_text_description() const {
function String (line 1520) | String Spell::get_name_translated() const {
function String (line 1528) | String Spell::get_description(const int class_level, const int character...
function String (line 1532) | String Spell::_get_description(const int class_level, const int characte...
function String (line 1587) | String Spell::aura_get_name_translated() const {
function String (line 1595) | String Spell::aura_get_description(const int class_level, const int char...
function String (line 1599) | String Spell::_aura_get_description(const int class_level, const int cha...
FILE: data/spells/spell.h
type TargetRelationType (line 54) | enum TargetRelationType {
type SpellTargetType (line 62) | enum SpellTargetType {
type SpellAOETargetType (line 72) | enum SpellAOETargetType {
function spell_type_get (line 88) | int spell_type_get() const;
function aura_heal_set_scaling_curve (line 413) | void aura_heal_set_scaling_curve(const Ref<Curve> &curve) { _aura_heal_s...
function aura_absorb_set_scaling_curve (line 416) | void aura_absorb_set_scaling_curve(const Ref<Curve> &curve) { _aura_abso...
function aura_set_add_states (line 420) | void aura_set_add_states(const int value) { _aura_add_states = value; }
function aura_set_remove_effects_with_states (line 423) | void aura_set_remove_effects_with_states(const int value) { _aura_remove...
function aura_set_supress_states (line 426) | void aura_set_supress_states(const int value) { _aura_supress_states = v...
function aura_diminishing_return_enabled_get (line 429) | bool aura_diminishing_return_enabled_get() const;
type AuraStatAttribute (line 663) | struct AuraStatAttribute {
FILE: data/spells/spell_cooldown_manipulation_data.h
function class (line 31) | class SpellCooldownManipulationData : public RefCounted {
FILE: data/spells/spell_effect_visual.h
function class (line 31) | class SpellEffectVisual : public Resource {
FILE: data/spells/spell_effect_visual_simple.h
function class (line 32) | class SpellEffectVisualSimple : public SpellEffectVisual {
FILE: database/ess_resource_db.cpp
function StringName (line 127) | StringName ESSResourceDB::entity_resource_id_to_path(const int id) const {
function StringName (line 138) | StringName ESSResourceDB::entity_skill_id_to_path(const int id) const {
function StringName (line 149) | StringName ESSResourceDB::entity_data_id_to_path(const int id) const {
function StringName (line 160) | StringName ESSResourceDB::spell_id_to_path(const int id) const {
function StringName (line 171) | StringName ESSResourceDB::craft_recipe_id_to_path(const int id) const {
function StringName (line 182) | StringName ESSResourceDB::item_template_id_to_path(const int id) const {
function StringName (line 193) | StringName ESSResourceDB::entity_species_id_to_path(const int id) const {
FILE: database/ess_resource_db.h
function class (line 48) | class ESSResourceDB : public Resource {
FILE: database/ess_resource_db_folders.cpp
function PoolStringArray (line 47) | PoolStringArray ESSResourceDBFolders::get_folders() const {
FILE: database/ess_resource_db_folders.h
function class (line 55) | class ESSResourceDBFolders : public ESSResourceDBMap {
FILE: database/ess_resource_db_map.h
function class (line 55) | class ESSResourceDBMap : public ESSResourceDB {
FILE: database/ess_resource_db_static.h
function class (line 47) | class ESSResourceDBStatic : public ESSResourceDB {
FILE: defines.h
type class (line 45) | typedef class RenderingServer
type class (line 46) | typedef class RenderingServer VS;
FILE: drag_and_drop/es_drag_and_drop.cpp
function Node (line 27) | Node *ESDragAndDrop::get_origin() const {
function StringName (line 41) | StringName ESDragAndDrop::get_item_path() const {
FILE: drag_and_drop/es_drag_and_drop.h
type ESDragAndDropType (line 40) | enum ESDragAndDropType {
FILE: editor/ess_editor_plugin.h
function class (line 31) | class ESSEditorPlugin : public EditorPlugin {
FILE: entities/ai/entity_ai.cpp
function Entity (line 67) | Entity *EntityAI::get_owner() {
function String (line 102) | String EntityAI::get_editor_description() const {
FILE: entities/ai/entity_ai.h
function class (line 43) | class EntityAI : public Resource {
FILE: entities/auras/aura_data.cpp
function Entity (line 87) | Entity *AuraData::get_owner() {
function Entity (line 107) | Entity *AuraData::caster_get() {
function NodePath (line 144) | NodePath AuraData::caster_get_path() {
function Dictionary (line 280) | Dictionary AuraData::to_dict() {
function Dictionary (line 286) | Dictionary AuraData::_to_dict() {
function Array (line 339) | Array AuraData::to_send_array() {
function Array (line 345) | Array AuraData::_to_send_array() {
FILE: entities/auras/aura_data.h
function class (line 38) | class AuraData : public Resource {
FILE: entities/data/character_spec.h
function class (line 35) | class CharacterSpec : public Resource {
FILE: entities/data/entity_class_data.cpp
function String (line 45) | String EntityClassData::get_text_description() {
FILE: entities/data/entity_class_data.h
function class (line 59) | class EntityClassData : public Resource {
FILE: entities/data/entity_data.cpp
function String (line 44) | String EntityData::get_text_description() const {
function String (line 183) | String EntityData::generate_name() {
FILE: entities/data/entity_data.h
function class (line 59) | class EntityData : public Resource {
FILE: entities/data/entity_data_container.cpp
function Dictionary (line 27) | Dictionary EntityDataContainer::to_dict() {
function Dictionary (line 34) | Dictionary EntityDataContainer::_to_dict() {
FILE: entities/data/entity_data_container.h
function class (line 32) | class EntityDataContainer : public Resource {
FILE: entities/data/item_container_data.h
function class (line 33) | class ItemContainerData : public Resource {
FILE: entities/data/item_container_data_entry.h
function class (line 33) | class ItemContainerDataEntry : public Resource {
FILE: entities/data/vendor_item_data.h
function class (line 33) | class VendorItemData : public Resource {
FILE: entities/data/vendor_item_data_entry.h
function class (line 34) | class VendorItemDataEntry : public Resource {
FILE: entities/entity.cpp
function NodePath (line 174) | NodePath Entity::get_body_path() {
function Node (line 185) | Node *Entity::get_body() {
function Spatial (line 188) | Spatial *Entity::get_body_3d() {
function Node2D (line 191) | Node2D *Entity::get_body_2d() {
function NodePath (line 224) | NodePath Entity::get_character_skeleton_path() {
function Node (line 232) | Node *Entity::get_character_skeleton() {
function Transform3D (line 268) | Transform3D Entity::get_transform_3d(bool only_stored) const {
function Transform2D (line 287) | Transform2D Entity::get_transform_2d(bool only_stored) const {
function String (line 421) | String Entity::gets_entity_name() {
function String (line 432) | String Entity::getc_entity_name() {
function StringName (line 537) | StringName Entity::gets_entity_data_path() {
function Entity (line 879) | Entity *Entity::pet_gets_owner() {
function Entity (line 992) | Entity *Entity::pet_gets(int index) {
function Entity (line 1066) | Entity *Entity::pet_getc(int index) {
function Dictionary (line 1117) | Dictionary Entity::to_dict() {
function Dictionary (line 1128) | Dictionary Entity::_to_dict() {
function PoolIntArray (line 1786) | PoolIntArray Entity::states_gets() const {
function EntityStat (line 2033) | EntityStat Entity::get_stat(const int stat_id) const {
function Entity (line 4612) | Entity *Entity::gets_target() {
function Entity (line 4664) | Entity *Entity::getc_target() {
function PoolIntArray (line 4931) | PoolIntArray Entity::sclass_talents_get() {
function PoolIntArray (line 5178) | PoolIntArray Entity::scharacter_talents_get() {
function String (line 5669) | String Entity::random_name() {
function Entity (line 5675) | Entity *Entity::sees_gets(int index) {
function Entity (line 5732) | Entity *Entity::seen_by_gets(int index) {
function Error (line 5772) | Error Entity::_vrpc(const StringName &p_method, const Variant **p_arg, i...
function Dictionary (line 5857) | Dictionary Entity::data_as_dict(String &data) {
FILE: entities/entity.h
type SpellCastDataSignals (line 82) | enum SpellCastDataSignals {
type PlayerStates (line 91) | enum PlayerStates {
type PlayerSendFlags (line 98) | enum PlayerSendFlags {
function class (line 330) | class Entity : public Node {
FILE: entities/resources/entity_resource.cpp
function String (line 40) | String EntityResource::get_text_name() const {
function Entity (line 83) | Entity *EntityResource::get_owner() {
function PoolRealArray (line 160) | PoolRealArray EntityResource::get_stacking_mods() {
function PoolRealArray (line 239) | PoolRealArray EntityResource::get_non_stacking_mods() {
function Dictionary (line 248) | Dictionary EntityResource::to_dict() {
function Dictionary (line 255) | Dictionary EntityResource::_to_dict() {
FILE: entities/resources/entity_resource.h
function class (line 35) | class EntityResource : public Resource {
FILE: entities/resources/entity_resource_cost_data.h
function class (line 34) | class EntityResourceCostData : public Resource {
FILE: entities/resources/entity_resource_cost_data_health.h
function class (line 34) | class EntityResourceCostDataHealth : public EntityResourceCostData {
FILE: entities/resources/entity_resource_cost_data_resource.h
function class (line 34) | class EntityResourceCostDataResource : public EntityResourceCostData {
FILE: entities/resources/entity_resource_health.h
function class (line 30) | class EntityResourceHealth : public EntityResource {
FILE: entities/resources/entity_resource_speed.h
function class (line 30) | class EntityResourceSpeed : public EntityResource {
FILE: entities/skills/entity_skill.cpp
function Dictionary (line 87) | Dictionary EntitySkill::to_dict() {
function Dictionary (line 94) | Dictionary EntitySkill::_to_dict() {
FILE: entities/skills/entity_skill.h
function class (line 33) | class EntitySkill : public Resource {
FILE: entities/skills/entity_skill_data.cpp
function String (line 46) | String EntitySkillData::get_text_description() const {
FILE: entities/skills/entity_skill_data.h
function class (line 32) | class EntitySkillData : public Resource {
FILE: entities/stats/complex_level_stat_data.h
function class (line 34) | class ComplexLevelStatData : public LevelStatData {
FILE: entities/stats/level_stat_data.h
function class (line 31) | class LevelStatData : public Resource {
FILE: entities/stats/simple_level_stat_data.h
function class (line 33) | class SimpleLevelStatData : public LevelStatData {
FILE: entities/stats/stat_data.h
function class (line 35) | class StatData : public Resource {
FILE: entity_enums.h
function class (line 32) | class EntityEnums : public Object {
FILE: formations/ai_formation.cpp
function Entity (line 49) | Entity *AIFormation::get_owner() {
function String (line 56) | String AIFormation::get_editor_description() const {
function Vector3 (line 64) | Vector3 AIFormation::get_position(int slot_index) {
FILE: formations/ai_formation.h
function class (line 35) | class AIFormation : public Resource {
FILE: infos/aura_infos.cpp
function Entity (line 27) | Entity *AuraApplyInfo::caster_get() const {
function Entity (line 49) | Entity *AuraApplyInfo::target_get() const {
FILE: infos/aura_infos.h
function class (line 36) | class AuraApplyInfo : public RefCounted {
FILE: infos/spell_cast_info.cpp
function Entity (line 38) | Entity *SpellCastInfo::caster_get() {
function Entity (line 62) | Entity *SpellCastInfo::target_get() {
function Dictionary (line 185) | Dictionary SpellCastInfo::to_dict() {
FILE: infos/spell_cast_info.h
function class (line 36) | class SpellCastInfo : public Resource {
FILE: inventory/bag.cpp
function Dictionary (line 328) | Dictionary Bag::to_dict() {
function Dictionary (line 335) | Dictionary Bag::_to_dict() {
FILE: inventory/bag.h
function class (line 37) | class Bag : public Resource {
FILE: inventory/grid_bag.h
function class (line 37) | class GridBag : public RefCounted {
FILE: inventory/inventory.cpp
function Player (line 38) | Player *Inventory::target_get() const {
FILE: inventory/inventory.h
function class (line 38) | class Inventory : public RefCounted {
FILE: inventory/normal_bag.h
function class (line 37) | class Bag : public RefCounted {
FILE: item_enums.cpp
function String (line 33) | String ItemEnums::get_armor_type_string(int type) {
FILE: item_enums.h
function class (line 33) | class ItemEnums : public Object {
FILE: material_cache/ess_material_cache.cpp
function Rect2 (line 176) | Rect2 ESSMaterialCache::texture_get_uv_rect(const Ref<Texture> &texture) {
FILE: material_cache/ess_material_cache.h
function class (line 40) | class ESSMaterialCache : public Resource {
FILE: material_cache/ess_material_cache_pcm.cpp
function Color (line 50) | Color ESSMaterialCachePCM::get_background_color() const {
function Rect2 (line 71) | Rect2 ESSMaterialCachePCM::texture_get_uv_rect(const Ref<Texture> &textu...
FILE: material_cache/ess_material_cache_pcm.h
function class (line 43) | class ESSMaterialCachePCM : public ESSMaterialCache {
FILE: pipelines/spell_damage_info.cpp
function Entity (line 69) | Entity *SpellDamageInfo::dealer_get() {
function Entity (line 89) | Entity *SpellDamageInfo::receiver_get() {
function Dictionary (line 180) | Dictionary SpellDamageInfo::to_dict() {
FILE: pipelines/spell_damage_info.h
function class (line 37) | class SpellDamageInfo : public RefCounted {
FILE: pipelines/spell_heal_info.cpp
function Entity (line 70) | Entity *SpellHealInfo::dealer_get() {
function Entity (line 90) | Entity *SpellHealInfo::receiver_get() {
function Dictionary (line 181) | Dictionary SpellHealInfo::to_dict() {
FILE: pipelines/spell_heal_info.h
function class (line 37) | class SpellHealInfo : public RefCounted {
FILE: profiles/actionbar/action_bar_button_entry.cpp
function StringName (line 68) | StringName ActionBarButtonEntry::get_item_path() const {
function Dictionary (line 85) | Dictionary ActionBarButtonEntry::to_dict() const {
FILE: profiles/actionbar/action_bar_button_entry.h
type ActionBarButtonEntryType (line 40) | enum ActionBarButtonEntryType {
FILE: profiles/actionbar/action_bar_entry.cpp
function Dictionary (line 101) | Dictionary ActionBarEntry::to_dict() const {
FILE: profiles/actionbar/action_bar_entry.h
function class (line 38) | class ActionBarEntry : public RefCounted {
FILE: profiles/actionbar/action_bar_profile.cpp
function String (line 36) | String ActionBarProfile::get_action_bar_profile_name() {
function Dictionary (line 117) | Dictionary ActionBarProfile::to_dict() const {
FILE: profiles/actionbar/action_bar_profile.h
function class (line 39) | class ActionBarProfile : public RefCounted {
FILE: profiles/class_profile.cpp
function StringName (line 27) | StringName ClassProfile::get_class_path() const {
function String (line 35) | String ClassProfile::get_character_class_name() const {
function Variant (line 101) | Variant ClassProfile::get_custom_data(const String &p_name) const {
function Dictionary (line 113) | Dictionary ClassProfile::to_dict() const {
FILE: profiles/class_profile.h
function class (line 36) | class ClassProfile : public RefCounted {
FILE: profiles/input/input_profile.cpp
function Array (line 40) | Array InputProfile::get_data() {
function Dictionary (line 90) | Dictionary InputProfile::to_dict() const {
FILE: profiles/input/input_profile.h
function class (line 34) | class InputProfile : public RefCounted {
FILE: profiles/input/input_profile_modifier.cpp
function String (line 37) | String InputProfileModifier::get_modifier(int index) {
FILE: profiles/input/input_profile_modifier.h
function class (line 35) | class InputProfileModifier : public RefCounted {
FILE: profiles/input/input_profile_modifier_entry.cpp
function String (line 25) | String InputProfileModifierEntry::get_action() {
function String (line 33) | String InputProfileModifierEntry::get_translate_to() {
FILE: profiles/input/input_profile_modifier_entry.h
function class (line 32) | class InputProfileModifierEntry : public RefCounted {
FILE: profiles/player_profile.cpp
function String (line 39) | String PlayerProfile::get_profile_name() {
function Dictionary (line 119) | Dictionary PlayerProfile::get_custom_data() {
function Dictionary (line 128) | Dictionary PlayerProfile::to_dict() const {
FILE: profiles/player_profile.h
function class (line 35) | class PlayerProfile : public RefCounted {
FILE: projectiles/3d/spell_follow_projectile_3d.h
function class (line 32) | class SpellFollowProjectile3D : public Spatial {
FILE: props/prop_data_entity.h
function class (line 32) | class PropDataEntity : public PropDataEntry {
FILE: register_types.cpp
function initialize_entity_spell_system_module (line 143) | void initialize_entity_spell_system_module(ModuleInitializationLevel p_l...
function uninitialize_entity_spell_system_module (line 287) | void uninitialize_entity_spell_system_module(ModuleInitializationLevel p...
FILE: singletons/ess.cpp
function ESS (line 33) | ESS *ESS::get_singleton() {
function ESSEntitySpawner (line 93) | ESSEntitySpawner *ESS::get_entity_spawner() {
function String (line 104) | String ESS::get_resource_db_path() {
function String (line 166) | String ESS::stat_get_string() const {
function StringName (line 175) | StringName ESS::stat_get_name(const int id) const {
function StringName (line 186) | StringName ESS::stat_get_property_name(const int id) const {
function PoolStringArray (line 199) | PoolStringArray ESS::stats_get() const {
function String (line 281) | String ESS::equip_slot_get_string() const {
function StringName (line 290) | StringName ESS::equip_slot_get_name(const int id) const {
function StringName (line 301) | StringName ESS::equip_slot_get_property_name(const int id) const {
function PoolStringArray (line 314) | PoolStringArray ESS::equip_slots_get() const {
function String (line 360) | String ESS::entity_types_get() const {
function String (line 367) | String ESS::skeletons_bones_index_get(const int index) const {
function PoolStringArray (line 376) | PoolStringArray ESS::skeletons_bones_get() const {
function String (line 383) | String ESS::skeletons_bone_attachment_index_get(const int index) const {
function PoolStringArray (line 392) | PoolStringArray ESS::skeletons_bone_attachment_points_get() const {
function String (line 400) | String ESS::model_visual_groups_get() const {
function String (line 407) | String ESS::texture_layers_get() const {
function String (line 415) | String ESS::dminishing_return_categories_get() const {
function PoolIntArray (line 464) | PoolIntArray ESS::get_character_xp_data() {
function PoolIntArray (line 489) | PoolIntArray ESS::get_class_xp_data() {
function Color (line 518) | Color ESS::get_background_color() const {
function StringName (line 533) | StringName ESS::get_default_ess_material_cache_class() {
function PoolStringArray (line 540) | PoolStringArray ESS::material_paths_get() const {
FILE: singletons/ess.h
function class (line 44) | class ESS : public Object {
FILE: singletons/profile_manager.cpp
function ProfileManager (line 37) | ProfileManager *ProfileManager::get_singleton() {
function String (line 55) | String ProfileManager::get_save_file() const {
function Dictionary (line 148) | Dictionary ProfileManager::to_dict() const {
FILE: singletons/profile_manager.h
function class (line 34) | class ProfileManager : public Object {
FILE: skeleton/character_bones.h
function class (line 28) | class CharacterBones : public Node2D {
FILE: skeleton/character_skeleton_2d.cpp
function NodePath (line 58) | NodePath CharacterSkeleton2D::attach_point_path_get(const int index) con...
function Node (line 70) | Node *CharacterSkeleton2D::attach_point_node_get(const int index) {
function Node (line 80) | Node *CharacterSkeleton2D::common_attach_point_node_get(const EntityEnum...
function NodePath (line 125) | NodePath CharacterSkeleton2D::get_animation_player_path() {
function AnimationPlayer (line 141) | AnimationPlayer *CharacterSkeleton2D::get_animation_player() {
function NodePath (line 145) | NodePath CharacterSkeleton2D::get_animation_tree_path() {
function AnimationTree (line 161) | AnimationTree *CharacterSkeleton2D::get_animation_tree() {
function Array (line 349) | Array CharacterSkeleton2D::merge_mesh_array(Array arr) const {
function Array (line 410) | Array CharacterSkeleton2D::bake_mesh_array_uv(Array arr, Ref<Texture> te...
FILE: skeleton/character_skeleton_2d.h
type _ModelEntryComparator (line 127) | struct _ModelEntryComparator {
type AttachPointNode (line 137) | struct AttachPointNode {
FILE: skeleton/character_skeleton_3d.cpp
function NodePath (line 58) | NodePath CharacterSkeleton3D::attach_point_path_get(const int index) con...
function Node (line 70) | Node *CharacterSkeleton3D::attach_point_node_get(const int index) {
function Node (line 80) | Node *CharacterSkeleton3D::common_attach_point_node_get(const EntityEnum...
function NodePath (line 125) | NodePath CharacterSkeleton3D::get_animation_player_path() {
function AnimationPlayer (line 141) | AnimationPlayer *CharacterSkeleton3D::get_animation_player() {
function NodePath (line 145) | NodePath CharacterSkeleton3D::get_animation_tree_path() {
function AnimationTree (line 161) | AnimationTree *CharacterSkeleton3D::get_animation_tree() {
function Transform3D (line 185) | Transform3D CharacterSkeleton3D::bone_additional_mesh_transform_transfor...
function Transform3D (line 196) | Transform3D CharacterSkeleton3D::bone_additional_mesh_transform_user_tra...
function Array (line 389) | Array CharacterSkeleton3D::merge_mesh_array(Array arr) const {
function Array (line 450) | Array CharacterSkeleton3D::bake_mesh_array_uv(Array arr, Ref<Texture> te...
FILE: skeleton/character_skeleton_3d.h
type _ModelEntryComparator (line 138) | struct _ModelEntryComparator {
type BoneModelAdditionalMeshTransforms (line 157) | struct BoneModelAdditionalMeshTransforms {
FILE: skeleton/entity_skeleton_data.h
function class (line 32) | class EntitySkeletonData : public Resource {
FILE: skeleton/skeleton_model_entry.cpp
function Color (line 39) | Color SkeletonModelEntry::get_color() const {
FILE: skeleton/skeleton_model_entry.h
function class (line 33) | class SkeletonModelEntry : public RefCounted {
FILE: spawners/ess_entity_spawner.cpp
function _FORCE_INLINE_ (line 29) | _FORCE_INLINE_ void ESSEntitySpawner::request_entity_spawn(Ref<EntityCre...
function _FORCE_INLINE_ (line 35) | _FORCE_INLINE_ void ESSEntitySpawner::request_entity_spawn_deferred(Ref<...
FILE: spawners/ess_entity_spawner.h
function class (line 32) | class ESSEntitySpawner : public Node {
FILE: spell_enums.h
function class (line 32) | class SpellEnums : public Object {
FILE: utility/entity_create_info.cpp
function String (line 73) | String EntityCreateInfo::get_entity_name() const {
function String (line 80) | String EntityCreateInfo::get_node_name() const {
function Transform3D (line 101) | Transform3D EntityCreateInfo::get_transform() const {
function Transform2D (line 108) | Transform2D EntityCreateInfo::get_transform2d() const {
function Dictionary (line 129) | Dictionary EntityCreateInfo::get_serialized_data() {
function NodePath (line 136) | NodePath EntityCreateInfo::get_parent_path() const {
function Entity (line 143) | Entity *EntityCreateInfo::get_created_entity() {
function Dictionary (line 161) | Dictionary EntityCreateInfo::to_dict() {
function Dictionary (line 168) | Dictionary EntityCreateInfo::_to_dict() {
FILE: utility/entity_create_info.h
function class (line 39) | class EntityCreateInfo : public RefCounted {
Condensed preview — 243 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,777K chars).
[
{
"path": ".gitignore",
"chars": 51,
"preview": ".import\r\n*.d\r\n*.o\r\n*.meta\r\n*.obj\r\n*.pyc\r\n*.bc\r\n*.os"
},
{
"path": "LICENSE",
"chars": 1060,
"preview": "Copyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof th"
},
{
"path": "README.md",
"chars": 23176,
"preview": "# Entity Spell System\n\nAn entity and spell system for the GODOT Engine, that is usable for both 2d, and 3d games. The ma"
},
{
"path": "SCsub",
"chars": 4132,
"preview": "import os\n\nImport('env')\n\nmodule_env = env.Clone()\n\nif os.path.isdir('../mesh_data_resource'):\n module_env.Append(CPP"
},
{
"path": "config.py",
"chars": 2276,
"preview": "\n\ndef can_build(env, platform):\n return True\n\n\ndef configure(env):\n\tpass\n\n\ndef get_doc_classes():\n return [\n "
},
{
"path": "data/atlases/character_atlas.cpp",
"chars": 1177,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/atlases/character_atlas.h",
"chars": 1351,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/atlases/character_atlas_entry.cpp",
"chars": 1198,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/atlases/character_atlas_entry.h",
"chars": 1378,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/auras/aura_group.cpp",
"chars": 1247,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/auras/aura_group.h",
"chars": 1313,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/craft_recipe.cpp",
"chars": 7567,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/craft_recipe.h",
"chars": 3359,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/craft_recipe_helper.cpp",
"chars": 2157,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/craft_recipe_helper.h",
"chars": 1629,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/equipment_data.cpp",
"chars": 3494,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/equipment_data.h",
"chars": 1757,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/item_instance.cpp",
"chars": 9664,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/item_instance.h",
"chars": 3069,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/item_template.cpp",
"chars": 24893,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/item_template.h",
"chars": 7033,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/model_visual.cpp",
"chars": 3773,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/model_visual.h",
"chars": 2000,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/model_visual_entry.cpp",
"chars": 10879,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/items/model_visual_entry.h",
"chars": 3761,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/loot/loot_data_base.cpp",
"chars": 7950,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/loot/loot_data_base.h",
"chars": 2540,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/entity_species_data.cpp",
"chars": 8265,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/entity_species_data.h",
"chars": 2957,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/species_instance.cpp",
"chars": 6267,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/species_instance.h",
"chars": 2363,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/species_model_data.cpp",
"chars": 18103,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/species/species_model_data.h",
"chars": 4779,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell.cpp",
"chars": 123157,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell.h",
"chars": 26683,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_cooldown_manipulation_data.cpp",
"chars": 1114,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_cooldown_manipulation_data.h",
"chars": 1636,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_effect_visual.cpp",
"chars": 1318,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_effect_visual.h",
"chars": 1388,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_effect_visual_simple.cpp",
"chars": 7066,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "data/spells/spell_effect_visual_simple.h",
"chars": 2932,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db.cpp",
"chars": 15815,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db.h",
"chars": 6517,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_folders.cpp",
"chars": 4949,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_folders.h",
"chars": 2509,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_map.cpp",
"chars": 9731,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_map.h",
"chars": 4580,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_static.cpp",
"chars": 10685,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "database/ess_resource_db_static.h",
"chars": 4254,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "defines.h",
"chars": 2700,
"preview": "\n#ifndef ESS_DEFINES_H\n#define ESS_DEFINES_H\n\n#include \"core/version.h\"\n\n#if VERSION_MAJOR >= 4\n#define GODOT4 true\n#end"
},
{
"path": "doc_classes/AIFormation.xml",
"chars": 915,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"AIFormation\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description"
},
{
"path": "doc_classes/ActionBarButtonEntry.xml",
"chars": 1862,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ActionBarButtonEntry\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_d"
},
{
"path": "doc_classes/ActionBarEntry.xml",
"chars": 1756,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ActionBarEntry\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descrip"
},
{
"path": "doc_classes/ActionBarProfile.xml",
"chars": 2137,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ActionBarProfile\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/AuraApplyInfo.xml",
"chars": 737,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"AuraApplyInfo\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/AuraData.xml",
"chars": 3553,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"AuraData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n\t"
},
{
"path": "doc_classes/AuraGroup.xml",
"chars": 681,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"AuraGroup\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n"
},
{
"path": "doc_classes/Bag.xml",
"chars": 7538,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"Bag\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n\t\tStor"
},
{
"path": "doc_classes/CharacterAtlas.xml",
"chars": 264,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterAtlas\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/CharacterAtlasEntry.xml",
"chars": 269,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterAtlasEntry\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_des"
},
{
"path": "doc_classes/CharacterBones.xml",
"chars": 262,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterBones\" inherits=\"Node2D\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/CharacterSkeleton2D.xml",
"chars": 6079,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterSkeleton2D\" inherits=\"Node2D\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/CharacterSkeleton3D.xml",
"chars": 7776,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterSkeleton3D\" inherits=\"Spatial\" version=\"3.5\">\n\t<brief_desc"
},
{
"path": "doc_classes/CharacterSpec.xml",
"chars": 2524,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CharacterSpec\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/ClassProfile.xml",
"chars": 2339,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ClassProfile\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/ComplexLevelStatData.xml",
"chars": 798,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ComplexLevelStatData\" inherits=\"LevelStatData\" version=\"3.5\">\n\t<bri"
},
{
"path": "doc_classes/CraftRecipe.xml",
"chars": 2873,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CraftRecipe\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description"
},
{
"path": "doc_classes/CraftRecipeHelper.xml",
"chars": 524,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"CraftRecipeHelper\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/ESDragAndDrop.xml",
"chars": 1196,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESDragAndDrop\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/ESS.xml",
"chars": 12287,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESS\" inherits=\"Object\" version=\"3.5\">\n\t<brief_description>\n\t\tThe ES"
},
{
"path": "doc_classes/ESSEntitySpawner.xml",
"chars": 981,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSEntitySpawner\" inherits=\"Node\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/ESSMaterialCache.xml",
"chars": 4171,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSMaterialCache\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descri"
},
{
"path": "doc_classes/ESSMaterialCachePCM.xml",
"chars": 948,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSMaterialCachePCM\" inherits=\"ESSMaterialCache\" version=\"3.5\">\n\t<b"
},
{
"path": "doc_classes/ESSResourceDB.xml",
"chars": 12045,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSResourceDB\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/ESSResourceDBFolders.xml",
"chars": 1327,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSResourceDBFolders\" inherits=\"ESSResourceDBMap\" version=\"3.5\">\n\t<"
},
{
"path": "doc_classes/ESSResourceDBMap.xml",
"chars": 271,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSResourceDBMap\" inherits=\"ESSResourceDB\" version=\"3.5\">\n\t<brief_d"
},
{
"path": "doc_classes/ESSResourceDBStatic.xml",
"chars": 1302,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ESSResourceDBStatic\" inherits=\"ESSResourceDB\" version=\"3.5\">\n\t<brie"
},
{
"path": "doc_classes/Entity.xml",
"chars": 106192,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"Entity\" inherits=\"Node\" version=\"3.5\">\n\t<brief_description>\n\t\tRepre"
},
{
"path": "doc_classes/EntityAI.xml",
"chars": 13230,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityAI\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n\t"
},
{
"path": "doc_classes/EntityClassData.xml",
"chars": 7162,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityClassData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descrip"
},
{
"path": "doc_classes/EntityCreateInfo.xml",
"chars": 3034,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityCreateInfo\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/EntityData.xml",
"chars": 3336,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>"
},
{
"path": "doc_classes/EntityDataContainer.xml",
"chars": 837,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityDataContainer\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_des"
},
{
"path": "doc_classes/EntityEnums.xml",
"chars": 12349,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityEnums\" inherits=\"Object\" version=\"3.5\">\n\t<brief_description>\n"
},
{
"path": "doc_classes/EntityResource.xml",
"chars": 6640,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResource\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/EntityResourceCostData.xml",
"chars": 463,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResourceCostData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_"
},
{
"path": "doc_classes/EntityResourceCostDataHealth.xml",
"chars": 292,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResourceCostDataHealth\" inherits=\"EntityResourceCostData\" ver"
},
{
"path": "doc_classes/EntityResourceCostDataResource.xml",
"chars": 458,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResourceCostDataResource\" inherits=\"EntityResourceCostData\" v"
},
{
"path": "doc_classes/EntityResourceHealth.xml",
"chars": 375,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResourceHealth\" inherits=\"EntityResource\" version=\"3.5\">\n\t<br"
},
{
"path": "doc_classes/EntityResourceSpeed.xml",
"chars": 374,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntityResourceSpeed\" inherits=\"EntityResource\" version=\"3.5\">\n\t<bri"
},
{
"path": "doc_classes/EntitySkill.xml",
"chars": 1922,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntitySkill\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description"
},
{
"path": "doc_classes/EntitySkillData.xml",
"chars": 936,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntitySkillData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descrip"
},
{
"path": "doc_classes/EntitySpeciesData.xml",
"chars": 3900,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EntitySpeciesData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/EquipmentData.xml",
"chars": 662,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"EquipmentData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/InputProfile.xml",
"chars": 987,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"InputProfile\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/InputProfileModifier.xml",
"chars": 2159,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"InputProfileModifier\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_d"
},
{
"path": "doc_classes/InputProfileModifierEntry.xml",
"chars": 572,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"InputProfileModifierEntry\" inherits=\"Reference\" version=\"3.5\">\n\t<br"
},
{
"path": "doc_classes/ItemContainerData.xml",
"chars": 1117,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ItemContainerData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/ItemContainerDataEntry.xml",
"chars": 498,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ItemContainerDataEntry\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_"
},
{
"path": "doc_classes/ItemEnums.xml",
"chars": 4376,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ItemEnums\" inherits=\"Object\" version=\"3.5\">\n\t<brief_description>\n\t\t"
},
{
"path": "doc_classes/ItemInstance.xml",
"chars": 4281,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ItemInstance\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/ItemTemplate.xml",
"chars": 9749,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ItemTemplate\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/LevelStatData.xml",
"chars": 874,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"LevelStatData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/LootDataBase.xml",
"chars": 2351,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"LootDataBase\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/ModelVisual.xml",
"chars": 1435,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ModelVisual\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description"
},
{
"path": "doc_classes/ModelVisualEntry.xml",
"chars": 3066,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ModelVisualEntry\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descri"
},
{
"path": "doc_classes/PlayerProfile.xml",
"chars": 2417,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"PlayerProfile\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/ProfileManager.xml",
"chars": 3189,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"ProfileManager\" inherits=\"Object\" version=\"3.5\">\n\t<brief_descriptio"
},
{
"path": "doc_classes/PropDataEntity.xml",
"chars": 499,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"PropDataEntity\" inherits=\"PropDataEntry\" version=\"3.5\">\n\t<brief_des"
},
{
"path": "doc_classes/SimpleLevelStatData.xml",
"chars": 693,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SimpleLevelStatData\" inherits=\"LevelStatData\" version=\"3.5\">\n\t<brie"
},
{
"path": "doc_classes/SkeletonModelEntry.xml",
"chars": 802,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SkeletonModelEntry\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_des"
},
{
"path": "doc_classes/SpeciesInstance.xml",
"chars": 1663,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpeciesInstance\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descrip"
},
{
"path": "doc_classes/SpeciesModelData.xml",
"chars": 6703,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpeciesModelData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descri"
},
{
"path": "doc_classes/Spell.xml",
"chars": 60135,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"Spell\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n\t\tBa"
},
{
"path": "doc_classes/SpellCastInfo.xml",
"chars": 2045,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellCastInfo\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descripti"
},
{
"path": "doc_classes/SpellCooldownManipulationData.xml",
"chars": 356,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellCooldownManipulationData\" inherits=\"Reference\" version=\"3.5\">\n"
},
{
"path": "doc_classes/SpellDamageInfo.xml",
"chars": 1969,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellDamageInfo\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descri"
},
{
"path": "doc_classes/SpellEffectVisual.xml",
"chars": 477,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellEffectVisual\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descr"
},
{
"path": "doc_classes/SpellEffectVisualSimple.xml",
"chars": 2013,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellEffectVisualSimple\" inherits=\"SpellEffectVisual\" version=\"3.5\""
},
{
"path": "doc_classes/SpellEnums.xml",
"chars": 8106,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellEnums\" inherits=\"Object\" version=\"3.5\">\n\t<brief_description>\n\t"
},
{
"path": "doc_classes/SpellFollowProjectile3D.xml",
"chars": 272,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellFollowProjectile3D\" inherits=\"Spatial\" version=\"3.5\">\n\t<brief_"
},
{
"path": "doc_classes/SpellHealInfo.xml",
"chars": 1947,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"SpellHealInfo\" inherits=\"Reference\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/StatData.xml",
"chars": 2131,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"StatData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_description>\n\t"
},
{
"path": "doc_classes/VendorItemData.xml",
"chars": 980,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"VendorItemData\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_descript"
},
{
"path": "doc_classes/VendorItemDataEntry.xml",
"chars": 927,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<class name=\"VendorItemDataEntry\" inherits=\"Resource\" version=\"3.5\">\n\t<brief_des"
},
{
"path": "drag_and_drop/es_drag_and_drop.cpp",
"chars": 2907,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "drag_and_drop/es_drag_and_drop.h",
"chars": 2051,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "editor/ess_editor_plugin.cpp",
"chars": 1481,
"preview": "/*\nCopyright (c) 2020-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "editor/ess_editor_plugin.h",
"chars": 1741,
"preview": "/*\nCopyright (c) 2020-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/ai/entity_ai.cpp",
"chars": 17880,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/ai/entity_ai.h",
"chars": 4873,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/auras/aura_data.cpp",
"chars": 12951,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/auras/aura_data.h",
"chars": 3269,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/character_spec.cpp",
"chars": 8420,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/character_spec.h",
"chars": 2317,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_class_data.cpp",
"chars": 18431,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_class_data.h",
"chars": 5344,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_data.cpp",
"chars": 11495,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_data.h",
"chars": 3995,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_data_container.cpp",
"chars": 2085,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/entity_data_container.h",
"chars": 1559,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/item_container_data.cpp",
"chars": 3154,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/item_container_data.h",
"chars": 1794,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/item_container_data_entry.cpp",
"chars": 2218,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/item_container_data_entry.h",
"chars": 1608,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/vendor_item_data.cpp",
"chars": 2765,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/vendor_item_data.h",
"chars": 1713,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/vendor_item_data_entry.cpp",
"chars": 3997,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/data/vendor_item_data_entry.h",
"chars": 1980,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/entity.cpp",
"chars": 251877,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/entity.h",
"chars": 46842,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource.cpp",
"chars": 15680,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource.h",
"chars": 3916,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data.cpp",
"chars": 1595,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data.h",
"chars": 1518,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data_health.cpp",
"chars": 1236,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data_health.h",
"chars": 1511,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data_resource.cpp",
"chars": 1904,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_cost_data_resource.h",
"chars": 1683,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_health.cpp",
"chars": 2746,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_health.h",
"chars": 1603,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_speed.cpp",
"chars": 2492,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/resources/entity_resource_speed.h",
"chars": 1591,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/skills/entity_skill.cpp",
"chars": 5197,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/skills/entity_skill.h",
"chars": 1911,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/skills/entity_skill_data.cpp",
"chars": 3085,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/skills/entity_skill_data.h",
"chars": 1766,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/complex_level_stat_data.cpp",
"chars": 4907,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/complex_level_stat_data.h",
"chars": 1878,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/level_stat_data.cpp",
"chars": 1527,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/level_stat_data.h",
"chars": 1377,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/simple_level_stat_data.cpp",
"chars": 3601,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/simple_level_stat_data.h",
"chars": 1809,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/stat_data.cpp",
"chars": 7166,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entities/stats/stat_data.h",
"chars": 2399,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entity_enums.cpp",
"chars": 8736,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "entity_enums.h",
"chars": 8565,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "formations/ai_formation.cpp",
"chars": 2951,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "formations/ai_formation.h",
"chars": 1634,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "infos/aura_infos.cpp",
"chars": 3641,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "infos/aura_infos.h",
"chars": 1968,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "infos/spell_cast_info.cpp",
"chars": 9125,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "infos/spell_cast_info.h",
"chars": 2803,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/bag.cpp",
"chars": 12648,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/bag.h",
"chars": 2492,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/grid_bag.cpp",
"chars": 8625,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/grid_bag.h",
"chars": 2444,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/inventory.cpp",
"chars": 2581,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/inventory.h",
"chars": 1688,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/normal_bag.cpp",
"chars": 4184,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "inventory/normal_bag.h",
"chars": 1901,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "item_enums.cpp",
"chars": 2164,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "item_enums.h",
"chars": 5732,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "material_cache/ess_material_cache.cpp",
"chars": 10920,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "material_cache/ess_material_cache.h",
"chars": 3117,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "material_cache/ess_material_cache_pcm.cpp",
"chars": 6648,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "material_cache/ess_material_cache_pcm.h",
"chars": 2357,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "pipelines/spell_damage_info.cpp",
"chars": 9420,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "pipelines/spell_damage_info.h",
"chars": 2884,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
},
{
"path": "pipelines/spell_heal_info.cpp",
"chars": 9152,
"preview": "/*\nCopyright (c) 2019-2022 Péter Magyar\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof"
}
]
// ... and 43 more files (download for full content)
About this extraction
This page contains the full source code of the Relintai/entity_spell_system GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 243 files (1.5 MB), approximately 434.9k tokens, and a symbol index with 293 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.