SQL setup
This commit is contained in:
@@ -14,6 +14,8 @@ include(FetchContent)
|
||||
message(STATUS "Using rapidyaml")
|
||||
message(STATUS "Using GLM")
|
||||
message(STATUS "Using TinyXML2")
|
||||
message(STATUS "Using SQLiteCpp")
|
||||
message(STATUS "Using rapidjson")
|
||||
|
||||
FetchContent_Declare(
|
||||
rapidyaml
|
||||
@@ -33,11 +35,23 @@ FetchContent_Declare(
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
sqlitecpp
|
||||
GIT_REPOSITORY https://github.com/SRombauts/SQLiteCpp.git
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
rapidjson
|
||||
GIT_REPOSITORY https://github.com/Tencent/rapidjson
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
# Enable exceptions in rapidyaml
|
||||
set(RYML_DEFAULT_CALLBACK_USES_EXCEPTIONS ON CACHE BOOL "" FORCE)
|
||||
set(RYML_DBG OFF CACHE BOOL "" FORCE)
|
||||
|
||||
FetchContent_MakeAvailable(rapidyaml glm tinyxml2)
|
||||
FetchContent_MakeAvailable(rapidyaml glm tinyxml2 sqlitecpp rapidjson)
|
||||
|
||||
# Create the main executable
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
@@ -45,6 +59,7 @@ add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
# Link libraries to our executable
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ryml::ryml)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC tinyxml2::tinyxml2)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC SQLiteCpp)
|
||||
|
||||
# Add include directories for rapidyaml
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${rapidyaml_SOURCE_DIR}/src)
|
||||
@@ -52,5 +67,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${rapidyaml_SOURCE_DIR}/src)
|
||||
# Add include directories for GLM
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${glm_SOURCE_DIR})
|
||||
|
||||
# Add include directories for rapidjson
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE ${rapidjson_SOURCE_DIR}/include)
|
||||
|
||||
# Include directories
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||
@@ -17,4 +17,13 @@ WorkbenchType stringToWorkbenchType(const std::string& str);
|
||||
GenstatType stringToGenstatType(const std::string& str);
|
||||
ActionType stringToActionType(const std::string& str);
|
||||
|
||||
std::string statTypeToString(StatType type);
|
||||
std::string itemCategoryToString(ItemCategory category);
|
||||
std::string itemTypeToString(ItemType type);
|
||||
std::string toolToString(Tool tool);
|
||||
std::string skillTypeToString(SkillType skill);
|
||||
std::string workbenchTypeToString(WorkbenchType workbench);
|
||||
std::string genstatTypeToString(GenstatType genstat);
|
||||
std::string actionTypeToString(ActionType action);
|
||||
|
||||
} // namespace cursebreaker
|
||||
@@ -6,14 +6,17 @@
|
||||
#include <fstream>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <SQLiteCpp/SQLiteCpp.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "assets/asset_base.hpp"
|
||||
#include "assets/scene.hpp"
|
||||
#include "configs/items.hpp"
|
||||
#include "configs/loot.hpp"
|
||||
#include "configs/harvestables.hpp"
|
||||
#include "configs/npcs.hpp"
|
||||
#include "configs/shops.hpp"
|
||||
#include "configs/achievements.hpp"
|
||||
#include "configs/items.h"
|
||||
#include "configs/loot.h"
|
||||
#include "configs/harvestables.h"
|
||||
#include "configs/npcs.h"
|
||||
#include "configs/shops.h"
|
||||
#include "configs/achievements.h"
|
||||
|
||||
struct AssetPath
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/achievements.hpp"
|
||||
#include "configs/achievements.h"
|
||||
#include "project_parser.h"
|
||||
#include "helpers.hpp"
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/harvestables.hpp"
|
||||
#include "configs/harvestables.h"
|
||||
#include "project_parser.h"
|
||||
#include "helpers.hpp"
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/items.hpp"
|
||||
#include "configs/items.h"
|
||||
#include "project_parser.h"
|
||||
#include "helpers.hpp"
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/loot.hpp"
|
||||
#include "configs/loot.h"
|
||||
#include "project_parser.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/npcs.hpp"
|
||||
#include "configs/npcs.h"
|
||||
#include "project_parser.h"
|
||||
#include "helpers.hpp"
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "configs/shops.hpp"
|
||||
#include "configs/shops.h"
|
||||
#include "project_parser.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
183
src/helpers.cpp
183
src/helpers.cpp
@@ -195,4 +195,187 @@ ActionType stringToActionType(const std::string& str) {
|
||||
return (it != actionMap.end()) ? it->second : ActionType::none;
|
||||
}
|
||||
|
||||
// Enum to string conversions
|
||||
std::string statTypeToString(StatType type) {
|
||||
switch (type) {
|
||||
case StatType::damagePhysical: return "damagephysical";
|
||||
case StatType::damageMagical: return "damagemagical";
|
||||
case StatType::damageRanged: return "damageranged";
|
||||
case StatType::accuracyPhysical: return "accuracyphysical";
|
||||
case StatType::accuracyMagical: return "accuracymagical";
|
||||
case StatType::accuracyRanged: return "accuracyranged";
|
||||
case StatType::resistancePhysical: return "resistancephysical";
|
||||
case StatType::resistanceMagical: return "resistancemagical";
|
||||
case StatType::resistanceRanged: return "resistanceranged";
|
||||
case StatType::health: return "health";
|
||||
case StatType::mana: return "mana";
|
||||
case StatType::manaregen: return "manaregen";
|
||||
case StatType::healthregen: return "healthregen";
|
||||
case StatType::movementSpeed: return "movementSpeed";
|
||||
case StatType::power: return "power";
|
||||
case StatType::critical: return "critical";
|
||||
case StatType::healing: return "healing";
|
||||
case StatType::DamageVsUndead: return "DamageVsUndead";
|
||||
case StatType::DamageVsBeasts: return "DamageVsBeasts";
|
||||
case StatType::CritterSlaying: return "CritterSlaying";
|
||||
case StatType::harvestingSpeedWoodcutting: return "harvestingSpeedWoodcutting";
|
||||
case StatType::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string itemCategoryToString(ItemCategory category) {
|
||||
switch (category) {
|
||||
case ItemCategory::bone: return "bone";
|
||||
case ItemCategory::bow: return "bow";
|
||||
case ItemCategory::crossbow: return "crossbow";
|
||||
case ItemCategory::constructable: return "constructable";
|
||||
case ItemCategory::torch: return "torch";
|
||||
case ItemCategory::blacksmithhammer: return "blacksmithhammer";
|
||||
case ItemCategory::questitem: return "questitem";
|
||||
case ItemCategory::heavyArmor: return "heavyArmor";
|
||||
case ItemCategory::warhammer: return "warhammer";
|
||||
case ItemCategory::shield: return "shield";
|
||||
case ItemCategory::hatchet: return "hatchet";
|
||||
case ItemCategory::blade: return "blade";
|
||||
case ItemCategory::armor: return "armor";
|
||||
case ItemCategory::pickaxe: return "pickaxe";
|
||||
case ItemCategory::fish: return "fish";
|
||||
case ItemCategory::fishingrod: return "fishingrod";
|
||||
case ItemCategory::shears: return "shears";
|
||||
case ItemCategory::hammer: return "hammer";
|
||||
case ItemCategory::battleaxe: return "battleaxe";
|
||||
case ItemCategory::morningstar: return "morningstar";
|
||||
case ItemCategory::wand: return "wand";
|
||||
case ItemCategory::staff: return "staff";
|
||||
case ItemCategory::dagger: return "dagger";
|
||||
case ItemCategory::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string itemTypeToString(ItemType type) {
|
||||
switch (type) {
|
||||
case ItemType::weapon: return "weapon";
|
||||
case ItemType::shield: return "shield";
|
||||
case ItemType::armor: return "armor";
|
||||
case ItemType::head: return "head";
|
||||
case ItemType::resource: return "resource";
|
||||
case ItemType::consumable: return "consumable";
|
||||
case ItemType::trinket: return "trinket";
|
||||
case ItemType::bracelet: return "bracelet";
|
||||
default: return "resource";
|
||||
}
|
||||
}
|
||||
|
||||
std::string toolToString(Tool tool) {
|
||||
switch (tool) {
|
||||
case Tool::hatchet: return "hatchet";
|
||||
case Tool::pickaxe: return "pickaxe";
|
||||
case Tool::broom: return "broom";
|
||||
case Tool::fishingrod: return "fishingrod";
|
||||
case Tool::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string skillTypeToString(SkillType skill) {
|
||||
switch (skill) {
|
||||
case SkillType::woodcutting: return "woodcutting";
|
||||
case SkillType::fishing: return "fishing";
|
||||
case SkillType::swordsmanship: return "swordsmanship";
|
||||
case SkillType::mining: return "mining";
|
||||
case SkillType::archery: return "archery";
|
||||
case SkillType::magic: return "magic";
|
||||
case SkillType::defence: return "defence";
|
||||
case SkillType::blacksmithy: return "blacksmithy";
|
||||
case SkillType::tailoring: return "tailoring";
|
||||
case SkillType::carpentry: return "carpentry";
|
||||
case SkillType::alchemy: return "alchemy";
|
||||
case SkillType::cooking: return "cooking";
|
||||
case SkillType::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string workbenchTypeToString(WorkbenchType workbench) {
|
||||
switch (workbench) {
|
||||
case WorkbenchType::none: return "none";
|
||||
case WorkbenchType::anvil: return "anvil";
|
||||
case WorkbenchType::oven: return "oven";
|
||||
case WorkbenchType::cooking: return "cooking";
|
||||
case WorkbenchType::carpenter: return "carpenter";
|
||||
case WorkbenchType::tailor: return "tailor";
|
||||
case WorkbenchType::forge: return "forge";
|
||||
case WorkbenchType::alchemist: return "alchemist";
|
||||
case WorkbenchType::mystic: return "mystic";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string genstatTypeToString(GenstatType genstat) {
|
||||
switch (genstat) {
|
||||
case GenstatType::dagger: return "dagger";
|
||||
case GenstatType::broadsword: return "broadsword";
|
||||
case GenstatType::battleaxe: return "battleaxe";
|
||||
case GenstatType::greatsword: return "greatsword";
|
||||
case GenstatType::morningstar: return "morningstar";
|
||||
case GenstatType::hammer: return "hammer";
|
||||
case GenstatType::spear: return "spear";
|
||||
case GenstatType::bow: return "bow";
|
||||
case GenstatType::staff: return "staff";
|
||||
case GenstatType::wand: return "wand";
|
||||
case GenstatType::crossbow: return "crossbow";
|
||||
case GenstatType::woodenshield: return "woodenshield";
|
||||
case GenstatType::wizardhat: return "wizardhat";
|
||||
case GenstatType::wizardrobe: return "wizardrobe";
|
||||
case GenstatType::grandwizardhat: return "grandwizardhat";
|
||||
case GenstatType::grandwizardrobe: return "grandwizardrobe";
|
||||
case GenstatType::leatherhood: return "leatherhood";
|
||||
case GenstatType::leatherbracelet: return "leatherbracelet";
|
||||
case GenstatType::leatherarmor: return "leatherarmor";
|
||||
case GenstatType::studdedleatherhood: return "studdedleatherhood";
|
||||
case GenstatType::studdedleatherbracelet: return "studdedleatherbracelet";
|
||||
case GenstatType::studdedleatherarmor: return "studdedleatherarmor";
|
||||
case GenstatType::helmet: return "helmet";
|
||||
case GenstatType::shield: return "shield";
|
||||
case GenstatType::armor: return "armor";
|
||||
case GenstatType::platehelmet: return "platehelmet";
|
||||
case GenstatType::kiteshield: return "kiteshield";
|
||||
case GenstatType::platearmor: return "platearmor";
|
||||
case GenstatType::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
std::string actionTypeToString(ActionType action) {
|
||||
switch (action) {
|
||||
case ActionType::NpcDeath: return "NpcDeath";
|
||||
case ActionType::PlayerDeath: return "PlayerDeath";
|
||||
case ActionType::PlayerRespawn: return "PlayerRespawn";
|
||||
case ActionType::NpcInteract: return "NpcInteract";
|
||||
case ActionType::QuestUpdate: return "QuestUpdate";
|
||||
case ActionType::QuestTimerEnd: return "QuestTimerEnd";
|
||||
case ActionType::UseItemOnItem: return "UseItemOnItem";
|
||||
case ActionType::UseItemOnNpc: return "UseItemOnNpc";
|
||||
case ActionType::ConsumeItem: return "ConsumeItem";
|
||||
case ActionType::NpcCombatInteract: return "NpcCombatInteract";
|
||||
case ActionType::NpcKilledByPlayer: return "NpcKilledByPlayer";
|
||||
case ActionType::EnterMap: return "EnterMap";
|
||||
case ActionType::VarUpdated: return "VarUpdated";
|
||||
case ActionType::GrantAchievement: return "GrantAchievement";
|
||||
case ActionType::PlayerKilledByNpc: return "PlayerKilledByNpc";
|
||||
case ActionType::UseItem: return "UseItem";
|
||||
case ActionType::CraftItem: return "CraftItem";
|
||||
case ActionType::HarvestItem: return "HarvestItem";
|
||||
case ActionType::BuyItem: return "BuyItem";
|
||||
case ActionType::NpcTagKilledByPlayer: return "NpcTagKilledByPlayer";
|
||||
case ActionType::UseAbility: return "UseAbility";
|
||||
case ActionType::LootItem: return "LootItem";
|
||||
case ActionType::UseItemCategoryOnItem: return "UseItemCategoryOnItem";
|
||||
case ActionType::none: return "none";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace cursebreaker
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "project_parser.h"
|
||||
#include "tree_builder.h"
|
||||
#include "assets/scene.hpp"
|
||||
#include "configs/items.hpp"
|
||||
#include "configs/items.h"
|
||||
|
||||
using namespace cursebreaker;
|
||||
|
||||
|
||||
@@ -27,8 +27,9 @@
|
||||
#include "assets/game_object.hpp"
|
||||
#include "assets/transform.hpp"
|
||||
#include "assets/mesh_filter.hpp"
|
||||
#include "assets/prefab_instance.hpp"
|
||||
|
||||
#include "assets/prefab_instance.hpp"
|
||||
#include "helpers.hpp"
|
||||
|
||||
namespace cursebreaker {
|
||||
|
||||
constexpr uint32_t fnv1a_hash(const char* str, uint32_t hash = 2166136261u)
|
||||
@@ -461,7 +462,4 @@ void ParseProject(const std::filesystem::path& projectRoot)
|
||||
project.m_prefabAssets = ParsePrefabs(std::vector<AssetPath>(prefabFiles.begin(), prefabFiles.end()), project.m_prefabsMap);
|
||||
|
||||
project.m_sceneAssets = ParseScenes(std::vector<AssetPath>(tilesFiles.begin(), tilesFiles.end()));
|
||||
}
|
||||
|
||||
|
||||
} // namespace cursebreaker
|
||||
}
|
||||
Reference in New Issue
Block a user