Merge branch 'main' into movingPlatformWork

This commit is contained in:
David Markowitz
2024-02-10 19:10:55 -08:00
810 changed files with 18865 additions and 15976 deletions

View File

@@ -0,0 +1,29 @@
#include "CDClientDatabase.h"
#include "CDComponentsRegistryTable.h"
// Static Variables
static CppSQLite3DB* conn = new CppSQLite3DB();
// Status Variables
bool CDClientDatabase::isConnected = false;
//! Opens a connection with the CDClient
void CDClientDatabase::Connect(const std::string& filename) {
conn->open(filename.c_str());
isConnected = true;
}
//! Queries the CDClient
CppSQLite3Query CDClientDatabase::ExecuteQuery(const std::string& query) {
return conn->execQuery(query.c_str());
}
//! Updates the CDClient file with Data Manipulation Language (DML) commands.
int CDClientDatabase::ExecuteDML(const std::string& query) {
return conn->execDML(query.c_str());
}
//! Makes prepared statements
CppSQLite3Statement CDClientDatabase::CreatePreppedStmt(const std::string& query) {
return conn->compileStatement(query.c_str());
}

View File

@@ -0,0 +1,50 @@
#pragma once
// C++
#include <string>
// SQLite
#include "CppSQLite3.h"
/*
* Optimization settings
*/
#include <sstream>
#include <iostream>
//! The CDClient Database namespace
namespace CDClientDatabase {
/**
* Boolean defining the connection status of CDClient
*/
extern bool isConnected;
//! Opens a connection with the CDClient
/*!
\param filename The filename
*/
void Connect(const std::string& filename);
//! Queries the CDClient
/*!
\param query The query
\return The results of the query
*/
CppSQLite3Query ExecuteQuery(const std::string& query);
//! Updates the CDClient file with Data Manipulation Language (DML) commands.
/*!
\param query The DML command to run. DML command can be multiple queries in one string but only
the last one will return its number of updated rows.
\return The number of updated rows.
*/
int ExecuteDML(const std::string& query);
//! Queries the CDClient and parses arguments
/*!
\param query The query with formatted arguments
\return prepared SQLite Statement
*/
CppSQLite3Statement CreatePreppedStmt(const std::string& query);
};

View File

@@ -0,0 +1,163 @@
#include "CDClientManager.h"
#include "CDActivityRewardsTable.h"
#include "CDAnimationsTable.h"
#include "CDBehaviorParameterTable.h"
#include "CDBehaviorTemplateTable.h"
#include "CDClientDatabase.h"
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDDestructibleComponentTable.h"
#include "CDEmoteTable.h"
#include "CDInventoryComponentTable.h"
#include "CDItemComponentTable.h"
#include "CDItemSetsTable.h"
#include "CDItemSetSkillsTable.h"
#include "CDLevelProgressionLookupTable.h"
#include "CDLootMatrixTable.h"
#include "CDLootTableTable.h"
#include "CDMissionNPCComponentTable.h"
#include "CDMissionTasksTable.h"
#include "CDMissionsTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDPhysicsComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
#include "CDVendorComponentTable.h"
#include "CDActivitiesTable.h"
#include "CDPackageComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDBrickIDTableTable.h"
#include "CDRarityTableTable.h"
#include "CDMissionEmailTable.h"
#include "CDRewardsTable.h"
#include "CDPropertyEntranceComponentTable.h"
#include "CDPropertyTemplateTable.h"
#include "CDFeatureGatingTable.h"
#include "CDRailActivatorComponent.h"
#include "CDRewardCodesTable.h"
#include "CDPetComponentTable.h"
#include <exception>
#ifndef CDCLIENT_CACHE_ALL
// Uncomment this to cache the full cdclient database into memory. This will make the server load faster, but will use more memory.
// A vanilla CDClient takes about 46MB of memory + the regular world data.
// # define CDCLIENT_CACHE_ALL
#endif // CDCLIENT_CACHE_ALL
#ifdef CDCLIENT_CACHE_ALL
#define CDCLIENT_DONT_CACHE_TABLE(x) x
#else
#define CDCLIENT_DONT_CACHE_TABLE(x)
#endif
class CDClientConnectionException : public std::exception {
public:
virtual const char* what() const throw() {
return "CDClientDatabase is not connected!";
}
};
// Using a macro to reduce repetitive code and issues from copy and paste.
// As a note, ## in a macro is used to concatenate two tokens together.
#define SPECIALIZE_TABLE_STORAGE(table) \
template<> typename table::StorageType& CDClientManager::GetEntriesMutable<table>() { return table##Entries; };
#define DEFINE_TABLE_STORAGE(table) namespace { table::StorageType table##Entries; }; SPECIALIZE_TABLE_STORAGE(table)
DEFINE_TABLE_STORAGE(CDActivityRewardsTable);
DEFINE_TABLE_STORAGE(CDActivitiesTable);
DEFINE_TABLE_STORAGE(CDAnimationsTable);
DEFINE_TABLE_STORAGE(CDBehaviorParameterTable);
DEFINE_TABLE_STORAGE(CDBehaviorTemplateTable);
DEFINE_TABLE_STORAGE(CDBrickIDTableTable);
DEFINE_TABLE_STORAGE(CDComponentsRegistryTable);
DEFINE_TABLE_STORAGE(CDCurrencyTableTable);
DEFINE_TABLE_STORAGE(CDDestructibleComponentTable);
DEFINE_TABLE_STORAGE(CDEmoteTableTable);
DEFINE_TABLE_STORAGE(CDFeatureGatingTable);
DEFINE_TABLE_STORAGE(CDInventoryComponentTable);
DEFINE_TABLE_STORAGE(CDItemComponentTable);
DEFINE_TABLE_STORAGE(CDItemSetSkillsTable);
DEFINE_TABLE_STORAGE(CDItemSetsTable);
DEFINE_TABLE_STORAGE(CDLevelProgressionLookupTable);
DEFINE_TABLE_STORAGE(CDLootMatrixTable);
DEFINE_TABLE_STORAGE(CDLootTableTable);
DEFINE_TABLE_STORAGE(CDMissionEmailTable);
DEFINE_TABLE_STORAGE(CDMissionNPCComponentTable);
DEFINE_TABLE_STORAGE(CDMissionTasksTable);
DEFINE_TABLE_STORAGE(CDMissionsTable);
DEFINE_TABLE_STORAGE(CDMovementAIComponentTable);
DEFINE_TABLE_STORAGE(CDObjectSkillsTable);
DEFINE_TABLE_STORAGE(CDObjectsTable);
DEFINE_TABLE_STORAGE(CDPhysicsComponentTable);
DEFINE_TABLE_STORAGE(CDPackageComponentTable);
DEFINE_TABLE_STORAGE(CDPetComponentTable);
DEFINE_TABLE_STORAGE(CDProximityMonitorComponentTable);
DEFINE_TABLE_STORAGE(CDPropertyEntranceComponentTable);
DEFINE_TABLE_STORAGE(CDPropertyTemplateTable);
DEFINE_TABLE_STORAGE(CDRailActivatorComponentTable);
DEFINE_TABLE_STORAGE(CDRarityTableTable);
DEFINE_TABLE_STORAGE(CDRebuildComponentTable);
DEFINE_TABLE_STORAGE(CDRewardCodesTable);
DEFINE_TABLE_STORAGE(CDRewardsTable);
DEFINE_TABLE_STORAGE(CDScriptComponentTable);
DEFINE_TABLE_STORAGE(CDSkillBehaviorTable);
DEFINE_TABLE_STORAGE(CDVendorComponentTable);
DEFINE_TABLE_STORAGE(CDZoneTableTable);
void CDClientManager::LoadValuesFromDatabase() {
if (!CDClientDatabase::isConnected) throw CDClientConnectionException();
CDActivityRewardsTable::Instance().LoadValuesFromDatabase();
CDActivitiesTable::Instance().LoadValuesFromDatabase();
CDCLIENT_DONT_CACHE_TABLE(CDAnimationsTable::Instance().LoadValuesFromDatabase());
CDBehaviorParameterTable::Instance().LoadValuesFromDatabase();
CDBehaviorTemplateTable::Instance().LoadValuesFromDatabase();
CDBrickIDTableTable::Instance().LoadValuesFromDatabase();
CDCLIENT_DONT_CACHE_TABLE(CDComponentsRegistryTable::Instance().LoadValuesFromDatabase());
CDCurrencyTableTable::Instance().LoadValuesFromDatabase();
CDDestructibleComponentTable::Instance().LoadValuesFromDatabase();
CDEmoteTableTable::Instance().LoadValuesFromDatabase();
CDFeatureGatingTable::Instance().LoadValuesFromDatabase();
CDInventoryComponentTable::Instance().LoadValuesFromDatabase();
CDCLIENT_DONT_CACHE_TABLE(CDItemComponentTable::Instance().LoadValuesFromDatabase());
CDItemSetSkillsTable::Instance().LoadValuesFromDatabase();
CDItemSetsTable::Instance().LoadValuesFromDatabase();
CDLevelProgressionLookupTable::Instance().LoadValuesFromDatabase();
CDCLIENT_DONT_CACHE_TABLE(CDLootMatrixTable::Instance().LoadValuesFromDatabase());
CDCLIENT_DONT_CACHE_TABLE(CDLootTableTable::Instance().LoadValuesFromDatabase());
CDMissionEmailTable::Instance().LoadValuesFromDatabase();
CDMissionNPCComponentTable::Instance().LoadValuesFromDatabase();
CDMissionTasksTable::Instance().LoadValuesFromDatabase();
CDMissionsTable::Instance().LoadValuesFromDatabase();
CDMovementAIComponentTable::Instance().LoadValuesFromDatabase();
CDObjectSkillsTable::Instance().LoadValuesFromDatabase();
CDCLIENT_DONT_CACHE_TABLE(CDObjectsTable::Instance().LoadValuesFromDatabase());
CDPhysicsComponentTable::Instance().LoadValuesFromDatabase();
CDPackageComponentTable::Instance().LoadValuesFromDatabase();
CDPetComponentTable::Instance().LoadValuesFromDatabase();
CDProximityMonitorComponentTable::Instance().LoadValuesFromDatabase();
CDPropertyEntranceComponentTable::Instance().LoadValuesFromDatabase();
CDPropertyTemplateTable::Instance().LoadValuesFromDatabase();
CDRailActivatorComponentTable::Instance().LoadValuesFromDatabase();
CDRarityTableTable::Instance().LoadValuesFromDatabase();
CDRebuildComponentTable::Instance().LoadValuesFromDatabase();
CDRewardCodesTable::Instance().LoadValuesFromDatabase();
CDRewardsTable::Instance().LoadValuesFromDatabase();
CDScriptComponentTable::Instance().LoadValuesFromDatabase();
CDSkillBehaviorTable::Instance().LoadValuesFromDatabase();
CDVendorComponentTable::Instance().LoadValuesFromDatabase();
CDZoneTableTable::Instance().LoadValuesFromDatabase();
}
void CDClientManager::LoadValuesFromDefaults() {
LOG("Loading default CDClient tables!");
CDPetComponentTable::Instance().LoadValuesFromDefaults();
}

View File

@@ -0,0 +1,44 @@
#ifndef __CDCLIENTMANAGER__H__
#define __CDCLIENTMANAGER__H__
#define UNUSED_TABLE(v)
/**
* Initialize the CDClient tables so they are all loaded into memory.
*/
namespace CDClientManager {
void LoadValuesFromDatabase();
void LoadValuesFromDefaults();
/**
* Fetch a table from CDClient
*
* @tparam Table type to fetch
* @return A pointer to the requested table.
*/
template<typename T>
T* GetTable();
/**
* Fetch a table from CDClient
* Note: Calling this function without a template specialization in CDClientManager.cpp will cause a linker error.
*
* @tparam Table type to fetch
* @return A pointer to the requested table.
*/
template<typename T>
typename T::StorageType& GetEntriesMutable();
};
// These are included after the CDClientManager namespace declaration as CDTable as of Jan 29 2024 relies on CDClientManager in Templated code.
#include "CDTable.h"
#include "Singleton.h"
template<typename T>
T* CDClientManager::GetTable() {
return &T::Instance();
};
#endif //!__CDCLIENTMANAGER__H__

View File

@@ -0,0 +1,58 @@
#include "CDActivitiesTable.h"
void CDActivitiesTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Activities");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
while (!tableData.eof()) {
CDActivities entry;
entry.ActivityID = tableData.getIntField("ActivityID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
entry.minTeams = tableData.getIntField("minTeams", -1);
entry.maxTeams = tableData.getIntField("maxTeams", -1);
entry.minTeamSize = tableData.getIntField("minTeamSize", -1);
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
entry.waitTime = tableData.getIntField("waitTime", -1);
entry.startDelay = tableData.getIntField("startDelay", -1);
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
entry.localize = tableData.getIntField("localize", -1);
entry.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
entry.showUIRewards = tableData.getIntField("showUIRewards", -1);
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1);
entry.gate_version = tableData.getStringField("gate_version", "");
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
std::vector<CDActivities> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,34 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDActivities {
uint32_t ActivityID;
uint32_t locStatus;
uint32_t instanceMapID;
uint32_t minTeams;
uint32_t maxTeams;
uint32_t minTeamSize;
uint32_t maxTeamSize;
uint32_t waitTime;
uint32_t startDelay;
bool requiresUniqueData;
uint32_t leaderboardType;
bool localize;
int32_t optionalCostLOT;
int32_t optionalCostCount;
bool showUIRewards;
uint32_t CommunityActivityFlagID;
std::string gate_version;
bool noTeamLootOnDeath;
float optionalPercentage;
};
class CDActivitiesTable : public CDTable<CDActivitiesTable, std::vector<CDActivities>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
};

View File

@@ -0,0 +1,47 @@
#include "CDActivityRewardsTable.h"
void CDActivityRewardsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ActivityRewards");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
while (!tableData.eof()) {
CDActivityRewards entry;
entry.objectTemplate = tableData.getIntField("objectTemplate", -1);
entry.ActivityRewardIndex = tableData.getIntField("ActivityRewardIndex", -1);
entry.activityRating = tableData.getIntField("activityRating", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
entry.ChallengeRating = tableData.getIntField("ChallengeRating", -1);
entry.description = tableData.getStringField("description", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
std::vector<CDActivityRewards> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,21 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDActivityRewards {
uint32_t objectTemplate; //!< The object template (?)
uint32_t ActivityRewardIndex; //!< The activity reward index
int32_t activityRating; //!< The activity rating
uint32_t LootMatrixIndex; //!< The loot matrix index
uint32_t CurrencyIndex; //!< The currency index
uint32_t ChallengeRating; //!< The challenge rating
std::string description; //!< The description
};
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable, std::vector<CDActivityRewards>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
};

View File

@@ -0,0 +1,117 @@
#include "CDAnimationsTable.h"
#include "GeneralUtils.h"
#include "Game.h"
void CDAnimationsTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
auto& animations = GetEntriesMutable();
while (!tableData.eof()) {
std::string animation_type = tableData.getStringField("animation_type", "");
DluAssert(!animation_type.empty());
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
DluAssert(animationGroupID != -1);
CDAnimation entry;
entry.animation_name = tableData.getStringField("animation_name", "");
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
UNUSED_COLUMN(entry.min_loops = tableData.getIntField("min_loops", 0);)
UNUSED_COLUMN(entry.max_loops = tableData.getIntField("max_loops", 0);)
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
UNUSED_COLUMN(entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;)
UNUSED_COLUMN(entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;)
UNUSED_COLUMN(entry.restartable = tableData.getIntField("restartable", 0) == 1;)
UNUSED_COLUMN(entry.face_animation_name = tableData.getStringField("face_animation_name", "");)
UNUSED_COLUMN(entry.priority = tableData.getFloatField("priority", 0.0f);)
UNUSED_COLUMN(entry.blendTime = tableData.getFloatField("blendTime", 0.0f);)
animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
bool CDAnimationsTable::CacheData(CppSQLite3Statement& queryToCache) {
auto tableData = queryToCache.execQuery();
// If we received a bad lookup, cache it anyways so we do not run the query again.
if (tableData.eof()) return false;
auto& animations = GetEntriesMutable();
do {
std::string animation_type = tableData.getStringField("animation_type", "");
DluAssert(!animation_type.empty());
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
DluAssert(animationGroupID != -1);
CDAnimation entry;
entry.animation_name = tableData.getStringField("animation_name", "");
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
UNUSED_COLUMN(entry.min_loops = tableData.getIntField("min_loops", 0);)
UNUSED_COLUMN(entry.max_loops = tableData.getIntField("max_loops", 0);)
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
UNUSED_COLUMN(entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;)
UNUSED_COLUMN(entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;)
UNUSED_COLUMN(entry.restartable = tableData.getIntField("restartable", 0) == 1;)
UNUSED_COLUMN(entry.face_animation_name = tableData.getStringField("face_animation_name", "");)
UNUSED_COLUMN(entry.priority = tableData.getFloatField("priority", 0.0f);)
UNUSED_COLUMN(entry.blendTime = tableData.getFloatField("blendTime", 0.0f);)
animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
tableData.nextRow();
} while (!tableData.eof());
tableData.finalize();
return true;
}
void CDAnimationsTable::CacheAnimations(const CDAnimationKey animationKey) {
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ? and animation_type = ?");
query.bind(1, static_cast<int32_t>(animationKey.second));
query.bind(2, animationKey.first.c_str());
auto& animations = GetEntriesMutable();
// If we received a bad lookup, cache it anyways so we do not run the query again.
if (!CacheData(query)) {
animations[animationKey];
}
}
void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
auto& animations = GetEntriesMutable();
auto animationEntryCached = animations.find(CDAnimationKey("", animationGroupID));
if (animationEntryCached != animations.end()) {
return;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ?");
query.bind(1, static_cast<int32_t>(animationGroupID));
// Cache the query so we don't run the query again.
CacheData(query);
animations[CDAnimationKey("", animationGroupID)];
}
std::optional<CDAnimation> CDAnimationsTable::GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID) {
auto& animations = GetEntriesMutable();
CDAnimationKey animationKey(animationType, animationGroupID);
auto animationEntryCached = animations.find(animationKey);
if (animationEntryCached == animations.end()) {
this->CacheAnimations(animationKey);
}
auto animationEntry = animations.find(animationKey);
// If we have only one animation, return it regardless of the chance to play.
if (animationEntry->second.size() == 1) {
return animationEntry->second.front();
}
auto randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
for (auto& animationEntry : animationEntry->second) {
randomAnimation -= animationEntry.chance_to_play;
// This is how the client gets the random animation.
if (animationEntry.animation_name != previousAnimationName && randomAnimation <= 0.0f) return animationEntry;
}
return std::nullopt;
}

View File

@@ -0,0 +1,61 @@
#pragma once
#include "CDTable.h"
#include <list>
#include <optional>
typedef int32_t AnimationGroupID;
typedef std::string AnimationID;
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
struct CDAnimation {
// uint32_t animationGroupID;
// std::string animation_type;
// The above two are a pair to represent a primary key in the map.
std::string animation_name; //!< The animation name
float chance_to_play; //!< The chance to play the animation
UNUSED_COLUMN(uint32_t min_loops;) //!< The minimum number of loops
UNUSED_COLUMN(uint32_t max_loops;) //!< The maximum number of loops
float animation_length; //!< The animation length
UNUSED_COLUMN(bool hideEquip;) //!< Whether or not to hide the equip
UNUSED_COLUMN(bool ignoreUpperBody;) //!< Whether or not to ignore the upper body
UNUSED_COLUMN(bool restartable;) //!< Whether or not the animation is restartable
UNUSED_COLUMN(std::string face_animation_name;) //!< The face animation name
UNUSED_COLUMN(float priority;) //!< The priority
UNUSED_COLUMN(float blendTime;) //!< The blend time
};
class CDAnimationsTable : public CDTable<CDAnimationsTable, std::map<CDAnimationKey, std::list<CDAnimation>>> {
public:
void LoadValuesFromDatabase();
/**
* Given an animationType and the previousAnimationName played, return the next animationType to play.
* If there are more than 1 animationTypes that can be played, one is selected at random but also does not allow
* the previousAnimationName to be played twice.
*
* @param animationType The animationID to lookup
* @param previousAnimationName The previously played animation
* @param animationGroupID The animationGroupID to lookup
* @return CDAnimationLookupResult
*/
[[nodiscard]] std::optional<CDAnimation> GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
/**
* Cache a full AnimationGroup by its ID.
*/
void CacheAnimationGroup(AnimationGroupID animationGroupID);
private:
/**
* Cache all animations given a premade key
*/
void CacheAnimations(const CDAnimationKey animationKey);
/**
* Run the query responsible for caching the data.
* @param queryToCache
* @return true
* @return false
*/
bool CacheData(CppSQLite3Statement& queryToCache);
};

View File

@@ -0,0 +1,62 @@
#include "CDBehaviorParameterTable.h"
#include "GeneralUtils.h"
namespace {
std::unordered_map<std::string, uint32_t> m_ParametersList;
};
uint64_t GetKey(const uint32_t behaviorID, const uint32_t parameterID) {
uint64_t key = behaviorID;
key <<= 31U;
key |= parameterID;
return key;
}
void CDBehaviorParameterTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
uint32_t behaviorID = tableData.getIntField("behaviorID", -1);
auto candidateStringToAdd = std::string(tableData.getStringField("parameterID", ""));
auto parameter = m_ParametersList.find(candidateStringToAdd);
uint32_t parameterId;
if (parameter != m_ParametersList.end()) {
parameterId = parameter->second;
} else {
parameterId = m_ParametersList.insert(std::make_pair(candidateStringToAdd, m_ParametersList.size())).first->second;
}
uint64_t hash = GetKey(behaviorID, parameterId);
float value = tableData.getFloatField("value", -1.0f);
entries.insert(std::make_pair(hash, value));
tableData.nextRow();
}
tableData.finalize();
}
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
auto parameterID = m_ParametersList.find(name);
if (parameterID == m_ParametersList.end()) return defaultValue;
auto hash = GetKey(behaviorID, parameterID->second);
// Search for specific parameter
auto& entries = GetEntriesMutable();
auto it = entries.find(hash);
return it != entries.end() ? it->second : defaultValue;
}
std::map<std::string, float> CDBehaviorParameterTable::GetParametersByBehaviorID(uint32_t behaviorID) {
auto& entries = GetEntriesMutable();
uint64_t hashBase = behaviorID;
std::map<std::string, float> returnInfo;
for (auto& [parameterString, parameterId] : m_ParametersList) {
uint64_t hash = GetKey(hashBase, parameterId);
auto infoCandidate = entries.find(hash);
if (infoCandidate != entries.end()) {
returnInfo.insert(std::make_pair(parameterString, infoCandidate->second));
}
}
return returnInfo;
}

View File

@@ -0,0 +1,18 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <unordered_map>
#include <unordered_set>
typedef uint64_t BehaviorParameterHash;
typedef float BehaviorParameterValue;
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable, std::unordered_map<BehaviorParameterHash, BehaviorParameterValue>> {
public:
void LoadValuesFromDatabase();
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
};

View File

@@ -0,0 +1,55 @@
#include "CDBehaviorTemplateTable.h"
namespace {
std::unordered_set<std::string> m_EffectHandles;
};
void CDBehaviorTemplateTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BehaviorTemplate");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDBehaviorTemplate entry;
entry.behaviorID = tableData.getIntField("behaviorID", -1);
entry.templateID = tableData.getIntField("templateID", -1);
entry.effectID = tableData.getIntField("effectID", -1);
auto candidateToAdd = tableData.getStringField(3, "");
auto parameter = m_EffectHandles.find(candidateToAdd);
if (parameter != m_EffectHandles.end()) {
entry.effectHandle = parameter;
} else {
entry.effectHandle = m_EffectHandles.insert(candidateToAdd).first;
}
entries.insert(std::make_pair(entry.behaviorID, entry));
tableData.nextRow();
}
tableData.finalize();
}
const CDBehaviorTemplate CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) {
auto& entries = GetEntriesMutable();
auto entry = entries.find(behaviorID);
if (entry == entries.end()) {
CDBehaviorTemplate entryToReturn;
entryToReturn.behaviorID = 0;
entryToReturn.effectHandle = m_EffectHandles.end();
entryToReturn.effectID = 0;
return entryToReturn;
} else {
return entry->second;
}
}

View File

@@ -0,0 +1,20 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <unordered_map>
#include <unordered_set>
struct CDBehaviorTemplate {
uint32_t behaviorID; //!< The Behavior ID
uint32_t templateID; //!< The Template ID (LOT)
uint32_t effectID; //!< The Effect ID attached
std::unordered_set<std::string>::iterator effectHandle; //!< The effect handle
};
class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable, std::unordered_map<uint32_t, CDBehaviorTemplate>> {
public:
void LoadValuesFromDatabase();
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);
};

View File

@@ -0,0 +1,40 @@
#include "CDBrickIDTableTable.h"
void CDBrickIDTableTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BrickIDTable");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BrickIDTable");
while (!tableData.eof()) {
CDBrickIDTable entry;
entry.NDObjectID = tableData.getIntField("NDObjectID", -1);
entry.LEGOBrickID = tableData.getIntField("LEGOBrickID", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
std::vector<CDBrickIDTable> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,24 @@
#pragma once
// Custom Classes
#include "CDTable.h"
/*!
\file CDBrickIDTableTable.hpp
\brief Contains data for the BrickIDTable table
*/
//! BrickIDTable Entry Struct
struct CDBrickIDTable {
uint32_t NDObjectID;
uint32_t LEGOBrickID;
};
//! BrickIDTable table
class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable, std::vector<CDBrickIDTable>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
};

View File

@@ -0,0 +1,53 @@
#include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.h"
void CDComponentsRegistryTable::LoadValuesFromDatabase() {
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1);
entries.insert_or_assign(static_cast<uint64_t>(entry.component_type) << 32 | static_cast<uint64_t>(entry.id), entry.component_id);
entries.insert_or_assign(entry.id, 0);
tableData.nextRow();
}
tableData.finalize();
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
auto& entries = GetEntriesMutable();
auto exists = entries.find(id);
if (exists != entries.end()) {
auto iter = entries.find(static_cast<uint64_t>(componentType) << 32 | static_cast<uint64_t>(id));
return iter == entries.end() ? defaultValue : iter->second;
}
// Now get the data. Get all components of this entity so we dont do a query for each component
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM ComponentsRegistry WHERE id = ?;");
query.bind(1, static_cast<int32_t>(id));
auto tableData = query.execQuery();
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1);
entries.insert_or_assign(static_cast<uint64_t>(entry.component_type) << 32 | static_cast<uint64_t>(entry.id), entry.component_id);
tableData.nextRow();
}
entries.insert_or_assign(id, 0);
auto iter = entries.find(static_cast<uint64_t>(componentType) << 32 | static_cast<uint64_t>(id));
return iter == entries.end() ? defaultValue : iter->second;
}

View File

@@ -0,0 +1,20 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <unordered_map>
enum class eReplicaComponentType : uint32_t;
struct CDComponentsRegistry {
uint32_t id; //!< The LOT is used as the ID
eReplicaComponentType component_type; //!< See ComponentTypes enum for values
uint32_t component_id; //!< The ID used within the component's table (0 may either mean it's non-networked, or that the ID is actually 0
};
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable, std::unordered_map<uint64_t, uint32_t>> {
public:
void LoadValuesFromDatabase();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
};

View File

@@ -0,0 +1,44 @@
#include "CDCurrencyTableTable.h"
//! Constructor
void CDCurrencyTableTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM CurrencyTable");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM CurrencyTable");
while (!tableData.eof()) {
CDCurrencyTable entry;
entry.currencyIndex = tableData.getIntField("currencyIndex", -1);
entry.npcminlevel = tableData.getIntField("npcminlevel", -1);
entry.minvalue = tableData.getIntField("minvalue", -1);
entry.maxvalue = tableData.getIntField("maxvalue", -1);
entry.id = tableData.getIntField("id", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) {
std::vector<CDCurrencyTable> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,26 @@
#pragma once
// Custom Classes
#include "CDTable.h"
/*!
\file CDCurrencyTableTable.hpp
\brief Contains data for the CurrencyTable table
*/
//! CurrencyTable Struct
struct CDCurrencyTable {
uint32_t currencyIndex; //!< The Currency Index
uint32_t npcminlevel; //!< The minimum level of the npc
uint32_t minvalue; //!< The minimum currency
uint32_t maxvalue; //!< The maximum currency
uint32_t id; //!< The ID of the currency index
};
//! CurrencyTable table
class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable, std::vector<CDCurrencyTable>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
};

View File

@@ -0,0 +1,51 @@
#include "CDDestructibleComponentTable.h"
void CDDestructibleComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM DestructibleComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
while (!tableData.eof()) {
CDDestructibleComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.faction = tableData.getIntField("faction", -1);
entry.factionList = tableData.getStringField("factionList", "");
entry.life = tableData.getIntField("life", -1);
entry.imagination = tableData.getIntField("imagination", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
entry.level = tableData.getIntField("level", -1);
entry.armor = tableData.getFloatField("armor", -1.0f);
entry.death_behavior = tableData.getIntField("death_behavior", -1);
entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false;
entry.attack_priority = tableData.getIntField("attack_priority", -1);
entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false;
entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) {
std::vector<CDDestructibleComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,28 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDDestructibleComponent {
uint32_t id; //!< The component ID from the ComponentsRegistry Table
int32_t faction; //!< The Faction ID of the object
std::string factionList; //!< A list of the faction IDs
int32_t life; //!< The amount of life of the object
uint32_t imagination; //!< The amount of imagination of the object
int32_t LootMatrixIndex; //!< The Loot Matrix Index
int32_t CurrencyIndex; //!< The Currency Index
uint32_t level; //!< ???
float armor; //!< The amount of armor of the object
uint32_t death_behavior; //!< The behavior ID of the death behavior
bool isnpc; //!< Whether or not the object is an NPC
uint32_t attack_priority; //!< ???
bool isSmashable; //!< Whether or not the object is smashable
int32_t difficultyLevel; //!< ???
};
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable, std::vector<CDDestructibleComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
};

View File

@@ -0,0 +1,28 @@
#include "CDEmoteTable.h"
void CDEmoteTableTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDEmoteTable entry;
entry.ID = tableData.getIntField("id", -1);
entry.animationName = tableData.getStringField("animationName", "");
entry.iconFilename = tableData.getStringField("iconFilename", "");
entry.channel = tableData.getIntField("channel", -1);
entry.locked = tableData.getIntField("locked", -1) != 0;
entry.localize = tableData.getIntField("localize", -1) != 0;
entry.locState = tableData.getIntField("locStatus", -1);
entry.gateVersion = tableData.getStringField("gate_version", "");
entries.insert(std::make_pair(entry.ID, entry));
tableData.nextRow();
}
tableData.finalize();
}
CDEmoteTable* CDEmoteTableTable::GetEmote(int32_t id) {
auto& entries = GetEntriesMutable();
auto itr = entries.find(id);
return itr != entries.end() ? &itr->second : nullptr;
}

View File

@@ -0,0 +1,34 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <map>
struct CDEmoteTable {
CDEmoteTable() {
ID = -1;
animationName = "";
iconFilename = "";
locState = -1;
channel = -1;
locked = false;
localize = false;
gateVersion = "";
}
int32_t ID;
std::string animationName;
std::string iconFilename;
int32_t locState;
int32_t channel;
bool locked;
bool localize;
std::string gateVersion;
};
class CDEmoteTableTable : public CDTable<CDEmoteTableTable, std::map<int, CDEmoteTable>> {
public:
void LoadValuesFromDatabase();
// Returns an emote by ID
CDEmoteTable* GetEmote(int32_t id);
};

View File

@@ -0,0 +1,56 @@
#include "CDFeatureGatingTable.h"
void CDFeatureGatingTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM FeatureGating");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM FeatureGating");
while (!tableData.eof()) {
CDFeatureGating entry;
entry.featureName = tableData.getStringField("featureName", "");
entry.major = tableData.getIntField("major", -1);
entry.current = tableData.getIntField("current", -1);
entry.minor = tableData.getIntField("minor", -1);
entry.description = tableData.getStringField("description", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) {
auto& entries = GetEntriesMutable();
std::vector<CDFeatureGating> data = cpplinq::from(entries)
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}
bool CDFeatureGatingTable::FeatureUnlocked(const CDFeatureGating& feature) const {
auto& entries = GetEntriesMutable();
for (const auto& entry : entries) {
if (entry.featureName == feature.featureName && feature >= entry) {
return true;
}
}
return false;
}

View File

@@ -0,0 +1,28 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDFeatureGating {
std::string featureName;
int32_t major;
int32_t current;
int32_t minor;
std::string description;
bool operator>=(const CDFeatureGating& b) const {
return (this->major > b.major) ||
(this->major == b.major && this->current > b.current) ||
(this->major == b.major && this->current == b.current && this->minor >= b.minor);
}
};
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable, std::vector<CDFeatureGating>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
bool FeatureUnlocked(const CDFeatureGating& feature) const;
};

View File

@@ -0,0 +1,42 @@
#include "CDInventoryComponentTable.h"
void CDInventoryComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM InventoryComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM InventoryComponent");
while (!tableData.eof()) {
CDInventoryComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.itemid = tableData.getIntField("itemid", -1);
entry.count = tableData.getIntField("count", -1);
entry.equip = tableData.getIntField("equip", -1) == 1 ? true : false;
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) {
std::vector<CDInventoryComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,18 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDInventoryComponent {
uint32_t id; //!< The component ID for this object
uint32_t itemid; //!< The LOT of the object
uint32_t count; //!< The count of the items the object has
bool equip; //!< Whether or not to equip the item
};
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable, std::vector<CDInventoryComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
};

View File

@@ -0,0 +1,166 @@
#include "CDItemComponentTable.h"
#include "GeneralUtils.h"
CDItemComponent CDItemComponentTable::Default = {};
void CDItemComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemComponent");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDItemComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.equipLocation = tableData.getStringField("equipLocation", "");
entry.baseValue = tableData.getIntField("baseValue", -1);
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
entry.rarity = tableData.getIntField("rarity", 0);
entry.itemType = tableData.getIntField("itemType", -1);
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
entry.stackSize = tableData.getIntField("stackSize", -1);
entry.color1 = tableData.getIntField("color1", -1);
entry.decal = tableData.getIntField("decal", -1);
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
entry.buildTypes = tableData.getIntField("buildTypes", -1);
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
entry.animationFlag = tableData.getIntField("animationFlag", 0);
entry.equipEffects = tableData.getIntField("equipEffects", -1);
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField("itemRating", -1);
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
entry.delResIndex = tableData.getIntField("delResIndex", -1);
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
UNUSED_COLUMN(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
UNUSED_COLUMN(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
}
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(uint32_t skillID) {
auto& entries = GetEntriesMutable();
const auto& it = entries.find(skillID);
if (it != entries.end()) {
return it->second;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM ItemComponent WHERE id = ?;");
query.bind(1, static_cast<int32_t>(skillID));
auto tableData = query.execQuery();
if (tableData.eof()) {
entries.insert(std::make_pair(skillID, Default));
return Default;
}
while (!tableData.eof()) {
CDItemComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.equipLocation = tableData.getStringField("equipLocation", "");
entry.baseValue = tableData.getIntField("baseValue", -1);
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
entry.rarity = tableData.getIntField("rarity", 0);
entry.itemType = tableData.getIntField("itemType", -1);
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
entry.stackSize = tableData.getIntField("stackSize", -1);
entry.color1 = tableData.getIntField("color1", -1);
entry.decal = tableData.getIntField("decal", -1);
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
entry.buildTypes = tableData.getIntField("buildTypes", -1);
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
entry.animationFlag = tableData.getIntField("animationFlag", 0);
entry.equipEffects = tableData.getIntField("equipEffects", -1);
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
entry.itemRating = tableData.getIntField("itemRating", -1);
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
entry.delResIndex = tableData.getIntField("delResIndex", -1);
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
const auto& it2 = entries.find(skillID);
if (it2 != entries.end()) {
return it2->second;
}
return Default;
}
std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDItemComponent& itemComponent) {
std::map<LOT, uint32_t> currencies = {};
if (!itemComponent.currencyCosts.empty()) {
auto currencySplit = GeneralUtils::SplitString(itemComponent.currencyCosts, ',');
for (const auto& currencyAmount : currencySplit) {
auto amountSplit = GeneralUtils::SplitString(currencyAmount, ':');
// Checking for 2 here, not sure what to do when there's more stuff than expected
if (amountSplit.size() == 2) {
currencies.insert({
std::stoull(amountSplit[0]),
std::stoi(amountSplit[1])
});
}
}
}
return currencies;
}

View File

@@ -0,0 +1,61 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include "dCommonVars.h"
struct CDItemComponent {
uint32_t id; //!< The Component ID
std::string equipLocation; //!< The equip location
uint32_t baseValue; //!< The monetary base value of the item
bool isKitPiece; //!< Whether or not the item belongs to a kit
uint32_t rarity; //!< The rarity of the item
uint32_t itemType; //!< The item type
int64_t itemInfo; //!< The item info
bool inLootTable; //!< Whether or not the item is in a loot table
bool inVendor; //!< Whether or not the item is in a vendor inventory
bool isUnique; //!< ???
bool isBOP; //!< ???
bool isBOE; //!< ???
uint32_t reqFlagID; //!< User must have completed this flag to get the item
uint32_t reqSpecialtyID; //!< ???
uint32_t reqSpecRank; //!< ???
uint32_t reqAchievementID; //!< The required achievement must be completed
uint32_t stackSize; //!< The stack size of the item
uint32_t color1; //!< Something to do with item color...
uint32_t decal; //!< The decal of the item
uint32_t offsetGroupID; //!< Something to do with group IDs
uint32_t buildTypes; //!< Something to do with building
std::string reqPrecondition; //!< The required precondition
uint32_t animationFlag; //!< The Animation Flag
uint32_t equipEffects; //!< The effect played when the item is equipped
bool readyForQA; //!< ???
uint32_t itemRating; //!< ???
bool isTwoHanded; //!< Whether or not the item is double handed
uint32_t minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
uint32_t delResIndex; //!< ???
uint32_t currencyLOT; //!< ???
uint32_t altCurrencyCost; //!< ???
std::string subItems; //!< A comma seperate string of sub items (maybe for multi-itemed things like faction test gear set)
UNUSED(std::string audioEventUse); //!< ???
bool noEquipAnimation; //!< Whether or not there is an equip animation
uint32_t commendationLOT; //!< The commendation LOT
uint32_t commendationCost; //!< The commendation cost
UNUSED(std::string audioEquipMetaEventSet); //!< ???
std::string currencyCosts; //!< Used for crafting
UNUSED(std::string ingredientInfo); //!< Unused
uint32_t locStatus; //!< ???
uint32_t forgeType; //!< Forge Type
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
};
class CDItemComponentTable : public CDTable<CDItemComponentTable, std::map<uint32_t, CDItemComponent>> {
public:
void LoadValuesFromDatabase();
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
// Gets an entry by ID
const CDItemComponent& GetItemComponentByID(uint32_t skillID);
static CDItemComponent Default;
};

View File

@@ -0,0 +1,52 @@
#include "CDItemSetSkillsTable.h"
void CDItemSetSkillsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSetSkills");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSetSkills");
while (!tableData.eof()) {
CDItemSetSkills entry;
entry.SkillSetID = tableData.getIntField("SkillSetID", -1);
entry.SkillID = tableData.getIntField("SkillID", -1);
entry.SkillCastType = tableData.getIntField("SkillCastType", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) {
std::vector<CDItemSetSkills> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(uint32_t SkillSetID) {
std::vector<CDItemSetSkills> toReturn;
for (const auto& entry : GetEntries()) {
if (entry.SkillSetID == SkillSetID) toReturn.push_back(entry);
if (entry.SkillSetID > SkillSetID) return toReturn; //stop seeking in the db if it's not needed.
}
return toReturn;
}

View File

@@ -0,0 +1,19 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDItemSetSkills {
uint32_t SkillSetID; //!< The skill set ID
uint32_t SkillID; //!< The skill ID
uint32_t SkillCastType; //!< The skill cast type
};
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable, std::vector<CDItemSetSkills>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
std::vector<CDItemSetSkills> GetBySkillID(uint32_t SkillSetID);
};

View File

@@ -0,0 +1,54 @@
#include "CDItemSetsTable.h"
void CDItemSetsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSets");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
while (!tableData.eof()) {
CDItemSets entry;
entry.setID = tableData.getIntField("setID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.itemIDs = tableData.getStringField("itemIDs", "");
entry.kitType = tableData.getIntField("kitType", -1);
entry.kitRank = tableData.getIntField("kitRank", -1);
entry.kitImage = tableData.getIntField("kitImage", -1);
entry.skillSetWith2 = tableData.getIntField("skillSetWith2", -1);
entry.skillSetWith3 = tableData.getIntField("skillSetWith3", -1);
entry.skillSetWith4 = tableData.getIntField("skillSetWith4", -1);
entry.skillSetWith5 = tableData.getIntField("skillSetWith5", -1);
entry.skillSetWith6 = tableData.getIntField("skillSetWith6", -1);
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField("gate_version", "");
entry.kitID = tableData.getIntField("kitID", -1);
entry.priority = tableData.getFloatField("priority", -1.0f);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
std::vector<CDItemSets> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,30 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDItemSets {
uint32_t setID; //!< The item set ID
uint32_t locStatus; //!< The loc status
std::string itemIDs; //!< THe item IDs
uint32_t kitType; //!< The item kit type
uint32_t kitRank; //!< The item kit rank
uint32_t kitImage; //!< The item kit image
uint32_t skillSetWith2; //!< The skill set with 2
uint32_t skillSetWith3; //!< The skill set with 3
uint32_t skillSetWith4; //!< The skill set with 4
uint32_t skillSetWith5; //!< The skill set with 5
uint32_t skillSetWith6; //!< The skill set with 6
bool localize; //!< Whether or localize
std::string gate_version; //!< The gate version
uint32_t kitID; //!< The kit ID
float priority; //!< The priority
};
class CDItemSetsTable : public CDTable<CDItemSetsTable, std::vector<CDItemSets>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
};

View File

@@ -0,0 +1,42 @@
#include "CDLevelProgressionLookupTable.h"
void CDLevelProgressionLookupTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LevelProgressionLookup");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LevelProgressionLookup");
while (!tableData.eof()) {
CDLevelProgressionLookup entry;
entry.id = tableData.getIntField("id", -1);
entry.requiredUScore = tableData.getIntField("requiredUScore", -1);
entry.BehaviorEffect = tableData.getStringField("BehaviorEffect", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {
std::vector<CDLevelProgressionLookup> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,18 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDLevelProgressionLookup {
uint32_t id; //!< The Level ID
uint32_t requiredUScore; //!< The required LEGO Score
std::string BehaviorEffect; //!< The behavior effect attached to this
};
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable, std::vector<CDLevelProgressionLookup>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
};

View File

@@ -0,0 +1,60 @@
#include "CDLootMatrixTable.h"
CDLootMatrix CDLootMatrixTable::ReadRow(CppSQLite3Query& tableData) const {
CDLootMatrix entry{};
if (tableData.eof()) return entry;
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
entry.RarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
entry.percent = tableData.getFloatField("percent", -1.0f);
entry.minToDrop = tableData.getIntField("minToDrop", -1);
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
entry.flagID = tableData.getIntField("flagID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
return entry;
}
void CDLootMatrixTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootMatrix");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
while (!tableData.eof()) {
CDLootMatrix entry;
uint32_t lootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entries[lootMatrixIndex].push_back(ReadRow(tableData));
tableData.nextRow();
}
}
const LootMatrixEntries& CDLootMatrixTable::GetMatrix(uint32_t matrixId) {
auto& entries = GetEntriesMutable();
auto itr = entries.find(matrixId);
if (itr != entries.end()) {
return itr->second;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM LootMatrix where LootMatrixIndex = ?;");
query.bind(1, static_cast<int32_t>(matrixId));
auto tableData = query.execQuery();
while (!tableData.eof()) {
entries[matrixId].push_back(ReadRow(tableData));
tableData.nextRow();
}
return entries[matrixId];
}

View File

@@ -0,0 +1,28 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDLootMatrix {
uint32_t LootTableIndex; //!< The Loot Table Index
uint32_t RarityTableIndex; //!< The Rarity Table Index
float percent; //!< The percent that this matrix is used?
uint32_t minToDrop; //!< The minimum amount of loot from this matrix to drop
uint32_t maxToDrop; //!< The maximum amount of loot from this matrix to drop
uint32_t flagID; //!< ???
UNUSED(std::string gate_version); //!< The Gate Version
};
typedef uint32_t LootMatrixIndex;
typedef std::vector<CDLootMatrix> LootMatrixEntries;
class CDLootMatrixTable : public CDTable<CDLootMatrixTable, std::unordered_map<LootMatrixIndex, LootMatrixEntries>> {
public:
void LoadValuesFromDatabase();
// Gets a matrix by ID or inserts a blank one if none existed.
const LootMatrixEntries& GetMatrix(uint32_t matrixId);
private:
CDLootMatrix ReadRow(CppSQLite3Query& tableData) const;
};

View File

@@ -0,0 +1,88 @@
#include "CDLootTableTable.h"
#include "CDClientManager.h"
#include "CDComponentsRegistryTable.h"
#include "CDItemComponentTable.h"
#include "eReplicaComponentType.h"
// Sort the tables by their rarity so the highest rarity items are first.
void SortTable(LootTableEntries& table) {
auto* componentsRegistryTable = CDClientManager::GetTable<CDComponentsRegistryTable>();
auto* itemComponentTable = CDClientManager::GetTable<CDItemComponentTable>();
// We modify the table in place so the outer loop keeps track of what is sorted
// and the inner loop finds the highest rarity item and swaps it with the current position
// of the outer loop.
for (auto oldItrOuter = table.begin(); oldItrOuter != table.end(); oldItrOuter++) {
auto lootToInsert = oldItrOuter;
// Its fine if this starts at 0, even if this doesnt match lootToInsert as the actual highest will
// either be found and overwrite these values, or the original is somehow zero and is still the highest rarity.
uint32_t highestLootRarity = 0;
for (auto oldItrInner = oldItrOuter; oldItrInner != table.end(); oldItrInner++) {
uint32_t itemComponentId = componentsRegistryTable->GetByIDAndType(oldItrInner->itemid, eReplicaComponentType::ITEM);
uint32_t rarity = itemComponentTable->GetItemComponentByID(itemComponentId).rarity;
if (rarity > highestLootRarity) {
highestLootRarity = rarity;
lootToInsert = oldItrInner;
}
}
std::swap(*oldItrOuter, *lootToInsert);
}
}
CDLootTable CDLootTableTable::ReadRow(CppSQLite3Query& tableData) const {
CDLootTable entry{};
if (tableData.eof()) return entry;
entry.itemid = tableData.getIntField("itemid", -1);
entry.MissionDrop = tableData.getIntField("MissionDrop", -1) == 1 ? true : false;
entry.sortPriority = tableData.getIntField("sortPriority", -1);
return entry;
}
void CDLootTableTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootTable");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
while (!tableData.eof()) {
CDLootTable entry;
uint32_t lootTableIndex = tableData.getIntField("LootTableIndex", -1);
entries[lootTableIndex].push_back(ReadRow(tableData));
tableData.nextRow();
}
for (auto& [id, table] : entries) {
SortTable(table);
}
}
const LootTableEntries& CDLootTableTable::GetTable(uint32_t tableId) {
auto& entries = GetEntriesMutable();
auto itr = entries.find(tableId);
if (itr != entries.end()) {
return itr->second;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM LootTable WHERE LootTableIndex = ?;");
query.bind(1, static_cast<int32_t>(tableId));
auto tableData = query.execQuery();
while (!tableData.eof()) {
CDLootTable entry;
entries[tableId].push_back(ReadRow(tableData));
tableData.nextRow();
}
SortTable(entries[tableId]);
return entries[tableId];
}

View File

@@ -0,0 +1,25 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDLootTable {
uint32_t itemid; //!< The LOT of the item
uint32_t LootTableIndex; //!< The Loot Table Index
bool MissionDrop; //!< Whether or not this loot table is a mission drop
uint32_t sortPriority; //!< The sorting priority
};
typedef uint32_t LootTableIndex;
typedef std::vector<CDLootTable> LootTableEntries;
class CDLootTableTable : public CDTable<CDLootTableTable, std::unordered_map<LootTableIndex, LootTableEntries>> {
private:
CDLootTable ReadRow(CppSQLite3Query& tableData) const;
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
const LootTableEntries& GetTable(uint32_t tableId);
};

View File

@@ -0,0 +1,47 @@
#include "CDMissionEmailTable.h"
void CDMissionEmailTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionEmail");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionEmail");
while (!tableData.eof()) {
CDMissionEmail entry;
entry.ID = tableData.getIntField("ID", -1);
entry.messageType = tableData.getIntField("messageType", -1);
entry.notificationGroup = tableData.getIntField("notificationGroup", -1);
entry.missionID = tableData.getIntField("missionID", -1);
entry.attachmentLOT = tableData.getIntField("attachmentLOT", 0);
entry.localize = static_cast<bool>(tableData.getIntField("localize", 1));
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.gate_version = tableData.getStringField("gate_version", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {
std::vector<CDMissionEmail> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,23 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDMissionEmail {
uint32_t ID;
uint32_t messageType;
uint32_t notificationGroup;
uint32_t missionID;
uint32_t attachmentLOT;
bool localize;
uint32_t locStatus;
std::string gate_version;
};
class CDMissionEmailTable : public CDTable<CDMissionEmailTable, std::vector<CDMissionEmail>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
};

View File

@@ -0,0 +1,45 @@
#include "CDMissionNPCComponentTable.h"
void CDMissionNPCComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionNPCComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionNPCComponent");
while (!tableData.eof()) {
CDMissionNPCComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.missionID = tableData.getIntField("missionID", -1);
entry.offersMission = tableData.getIntField("offersMission", -1) == 1 ? true : false;
entry.acceptsMission = tableData.getIntField("acceptsMission", -1) == 1 ? true : false;
entry.gate_version = tableData.getStringField("gate_version", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {
std::vector<CDMissionNPCComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,20 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDMissionNPCComponent {
uint32_t id; //!< The ID
uint32_t missionID; //!< The Mission ID
bool offersMission; //!< Whether or not this NPC offers a mission
bool acceptsMission; //!< Whether or not this NPC accepts a mission
std::string gate_version; //!< The gate version
};
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable, std::vector<CDMissionNPCComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
};

View File

@@ -0,0 +1,69 @@
#include "CDMissionTasksTable.h"
void CDMissionTasksTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionTasks");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionTasks");
while (!tableData.eof()) {
CDMissionTasks entry;
entry.id = tableData.getIntField("id", -1);
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.taskType = tableData.getIntField("taskType", -1);
entry.target = tableData.getIntField("target", -1);
entry.targetGroup = tableData.getStringField("targetGroup", "");
entry.targetValue = tableData.getIntField("targetValue", -1);
entry.taskParam1 = tableData.getStringField("taskParam1", "");
UNUSED(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
UNUSED(entry.IconID = tableData.getIntField("IconID", -1));
entry.uid = tableData.getIntField("uid", -1);
UNUSED(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) {
std::vector<CDMissionTasks> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}
std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missionID) {
std::vector<CDMissionTasks*> tasks;
// TODO: this should not be linear(?) and also shouldnt need to be a pointer
for (auto& entry : GetEntriesMutable()) {
if (entry.id == missionID) {
tasks.push_back(&entry);
}
}
return tasks;
}
const typename CDMissionTasksTable::StorageType& CDMissionTasksTable::GetEntries() const {
return CDTable::GetEntries();
}

View File

@@ -0,0 +1,33 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDMissionTasks {
uint32_t id; //!< The Mission ID that the task belongs to
UNUSED(uint32_t locStatus); //!< ???
uint32_t taskType; //!< The task type
uint32_t target; //!< The mission target
std::string targetGroup; //!< The mission target group
int32_t targetValue; //!< The target value
std::string taskParam1; //!< The task param 1
UNUSED(std::string largeTaskIcon); //!< ???
UNUSED(uint32_t IconID); //!< ???
uint32_t uid; //!< ???
UNUSED(uint32_t largeTaskIconID); //!< ???
UNUSED(bool localize); //!< Whether or not the task should be localized
UNUSED(std::string gate_version); //!< ???
};
class CDMissionTasksTable : public CDTable<CDMissionTasksTable, std::vector<CDMissionTasks>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
// TODO: Remove this and replace it with a proper lookup function.
const CDTable::StorageType& GetEntries() const;
};

View File

@@ -0,0 +1,120 @@
#include "CDMissionsTable.h"
CDMissions CDMissionsTable::Default = {};
void CDMissionsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Missions");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Missions");
while (!tableData.eof()) {
CDMissions entry;
entry.id = tableData.getIntField("id", -1);
entry.defined_type = tableData.getStringField("defined_type", "");
entry.defined_subtype = tableData.getStringField("defined_subtype", "");
entry.UISortOrder = tableData.getIntField("UISortOrder", -1);
entry.offer_objectID = tableData.getIntField("offer_objectID", -1);
entry.target_objectID = tableData.getIntField("target_objectID", -1);
entry.reward_currency = tableData.getInt64Field("reward_currency", -1);
entry.LegoScore = tableData.getIntField("LegoScore", -1);
entry.reward_reputation = tableData.getIntField("reward_reputation", -1);
entry.isChoiceReward = tableData.getIntField("isChoiceReward", -1) == 1 ? true : false;
entry.reward_item1 = tableData.getIntField("reward_item1", 0);
entry.reward_item1_count = tableData.getIntField("reward_item1_count", 0);
entry.reward_item2 = tableData.getIntField("reward_item2", 0);
entry.reward_item2_count = tableData.getIntField("reward_item2_count", 0);
entry.reward_item3 = tableData.getIntField("reward_item3", 0);
entry.reward_item3_count = tableData.getIntField("reward_item3_count", 0);
entry.reward_item4 = tableData.getIntField("reward_item4", 0);
entry.reward_item4_count = tableData.getIntField("reward_item4_count", 0);
entry.reward_emote = tableData.getIntField("reward_emote", -1);
entry.reward_emote2 = tableData.getIntField("reward_emote2", -1);
entry.reward_emote3 = tableData.getIntField("reward_emote3", -1);
entry.reward_emote4 = tableData.getIntField("reward_emote4", -1);
entry.reward_maximagination = tableData.getIntField("reward_maximagination", -1);
entry.reward_maxhealth = tableData.getIntField("reward_maxhealth", -1);
entry.reward_maxinventory = tableData.getIntField("reward_maxinventory", -1);
entry.reward_maxmodel = tableData.getIntField("reward_maxmodel", -1);
entry.reward_maxwidget = tableData.getIntField("reward_maxwidget", -1);
entry.reward_maxwallet = tableData.getIntField("reward_maxwallet", -1);
entry.repeatable = tableData.getIntField("repeatable", -1) == 1 ? true : false;
entry.reward_currency_repeatable = tableData.getIntField("reward_currency_repeatable", -1);
entry.reward_item1_repeatable = tableData.getIntField("reward_item1_repeatable", -1);
entry.reward_item1_repeat_count = tableData.getIntField("reward_item1_repeat_count", -1);
entry.reward_item2_repeatable = tableData.getIntField("reward_item2_repeatable", -1);
entry.reward_item2_repeat_count = tableData.getIntField("reward_item2_repeat_count", -1);
entry.reward_item3_repeatable = tableData.getIntField("reward_item3_repeatable", -1);
entry.reward_item3_repeat_count = tableData.getIntField("reward_item3_repeat_count", -1);
entry.reward_item4_repeatable = tableData.getIntField("reward_item4_repeatable", -1);
entry.reward_item4_repeat_count = tableData.getIntField("reward_item4_repeat_count", -1);
entry.time_limit = tableData.getIntField("time_limit", -1);
entry.isMission = tableData.getIntField("isMission", -1) ? true : false;
entry.missionIconID = tableData.getIntField("missionIconID", -1);
entry.prereqMissionID = tableData.getStringField("prereqMissionID", "");
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.inMOTD = tableData.getIntField("inMOTD", -1) == 1 ? true : false;
entry.cooldownTime = tableData.getInt64Field("cooldownTime", -1);
entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false;
entry.randomPool = tableData.getStringField("randomPool", "");
entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
Default.id = -1;
}
std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) {
std::vector<CDMissions> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}
const CDMissions* CDMissionsTable::GetPtrByMissionID(uint32_t missionID) const {
for (const auto& entry : GetEntries()) {
if (entry.id == missionID) {
return const_cast<CDMissions*>(&entry);
}
}
return &Default;
}
const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& found) const {
for (const auto& entry : GetEntries()) {
if (entry.id == missionID) {
found = true;
return entry;
}
}
found = false;
return Default;
}

View File

@@ -0,0 +1,75 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <map>
#include <cstdint>
struct CDMissions {
int32_t id; //!< The Mission ID
std::string defined_type; //!< The type of mission
std::string defined_subtype; //!< The subtype of the mission
int32_t UISortOrder; //!< The UI Sort Order for the mission
int32_t offer_objectID; //!< The LOT of the mission giver
int32_t target_objectID; //!< The LOT of the mission's target
int64_t reward_currency; //!< The amount of currency to reward the player
int32_t LegoScore; //!< The amount of LEGO Score to reward the player
int64_t reward_reputation; //!< The reputation to award the player
bool isChoiceReward; //!< Whether or not the user has the option to choose their loot
int32_t reward_item1; //!< The first rewarded item
int32_t reward_item1_count; //!< The count of the first item to be rewarded
int32_t reward_item2; //!< The second rewarded item
int32_t reward_item2_count; //!< The count of the second item to be rewarded
int32_t reward_item3; //!< The third rewarded item
int32_t reward_item3_count; //!< The count of the third item to be rewarded
int32_t reward_item4; //!< The fourth rewarded item
int32_t reward_item4_count; //!< The count of the fourth item to be rewarded
int32_t reward_emote; //!< The first emote to be rewarded
int32_t reward_emote2; //!< The second emote to be rewarded
int32_t reward_emote3; //!< The third emote to be rewarded
int32_t reward_emote4; //!< The fourth emote to be rewarded
int32_t reward_maximagination; //!< The amount of max imagination to reward
int32_t reward_maxhealth; //!< The amount of max health to reward
int32_t reward_maxinventory; //!< The amount of max inventory to reward
int32_t reward_maxmodel; //!< ???
int32_t reward_maxwidget; //!< ???
int32_t reward_maxwallet; //!< ???
bool repeatable; //!< Whether or not this mission can be repeated (for instance, is it a daily mission)
int64_t reward_currency_repeatable; //!< The repeatable reward
int32_t reward_item1_repeatable; //!< The first rewarded item
int32_t reward_item1_repeat_count; //!< The count of the first item to be rewarded
int32_t reward_item2_repeatable; //!< The second rewarded item
int32_t reward_item2_repeat_count; //!< The count of the second item to be rewarded
int32_t reward_item3_repeatable; //!< The third rewarded item
int32_t reward_item3_repeat_count; //!< The count of the third item to be rewarded
int32_t reward_item4_repeatable; //!< The fourth rewarded item
int32_t reward_item4_repeat_count; //!< The count of the fourth item to be rewarded
int32_t time_limit; //!< The time limit of the mission
bool isMission; //!< Maybe to differentiate between missions and achievements?
int32_t missionIconID; //!< The mission icon ID
std::string prereqMissionID; //!< A '|' seperated list of prerequisite missions
bool localize; //!< Whether or not to localize the mission
bool inMOTD; //!< In Match of the Day(?)
int64_t cooldownTime; //!< The mission cooldown time
bool isRandom; //!< ???
std::string randomPool; //!< ???
int32_t UIPrereqID; //!< ???
UNUSED(std::string gate_version); //!< The gate version
UNUSED(std::string HUDStates); //!< ???
UNUSED(int32_t locStatus); //!< ???
int32_t reward_bankinventory; //!< The amount of bank space this mission rewards
};
class CDMissionsTable : public CDTable<CDMissionsTable, std::vector<CDMissions>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
const CDMissions& GetByMissionID(uint32_t missionID, bool& found) const;
static CDMissions Default;
};

View File

@@ -0,0 +1,47 @@
#include "CDMovementAIComponentTable.h"
void CDMovementAIComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MovementAIComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MovementAIComponent");
while (!tableData.eof()) {
CDMovementAIComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.MovementType = tableData.getStringField("MovementType", "");
entry.WanderChance = tableData.getFloatField("WanderChance", -1.0f);
entry.WanderDelayMin = tableData.getFloatField("WanderDelayMin", -1.0f);
entry.WanderDelayMax = tableData.getFloatField("WanderDelayMax", -1.0f);
entry.WanderSpeed = tableData.getFloatField("WanderSpeed", -1.0f);
entry.WanderRadius = tableData.getFloatField("WanderRadius", -1.0f);
entry.attachedPath = tableData.getStringField("attachedPath", "");
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::function<bool(CDMovementAIComponent)> predicate) {
std::vector<CDMovementAIComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,22 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDMovementAIComponent {
uint32_t id;
std::string MovementType;
float WanderChance;
float WanderDelayMin;
float WanderDelayMax;
float WanderSpeed;
float WanderRadius;
std::string attachedPath;
};
class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable, std::vector<CDMovementAIComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
};

View File

@@ -0,0 +1,45 @@
#include "CDMovingPlatformComponentTable.h"
CDMovingPlatformComponentTable::CDMovingPlatformComponentTable() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MovingPlatforms");
while (!tableData.eof()) {
CDMovingPlatformTableEntry entry;
entry.platformIsSimpleMover = tableData.getIntField("platformIsSimpleMover", 0) == 1;
entry.platformStartAtEnd = tableData.getIntField("platformStartAtEnd", 0) == 1;
entry.platformMove.x = tableData.getFloatField("platformMoveX", 0.0f);
entry.platformMove.y = tableData.getFloatField("platformMoveY", 0.0f);
entry.platformMove.z = tableData.getFloatField("platformMoveZ", 0.0f);
entry.moveTime = tableData.getFloatField("platformMoveTime", -1.0f);
DluAssert(m_Platforms.insert(std::make_pair(tableData.getIntField("id", -1), entry)).second);
tableData.nextRow();
}
}
void CDMovingPlatformComponentTable::CachePlatformEntry(ComponentID id) {
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM MovingPlatforms WHERE id = ?;");
query.bind(1, static_cast<int32_t>(id));
auto tableData = query.execQuery();
while (!tableData.eof()) {
CDMovingPlatformTableEntry entry;
entry.platformIsSimpleMover = tableData.getIntField("platformIsSimpleMover", 0) == 1;
entry.platformStartAtEnd = tableData.getIntField("platformStartAtEnd", 0) == 1;
entry.platformMove.x = tableData.getFloatField("platformMoveX", 0.0f);
entry.platformMove.y = tableData.getFloatField("platformMoveY", 0.0f);
entry.platformMove.z = tableData.getFloatField("platformMoveZ", 0.0f);
entry.moveTime = tableData.getFloatField("platformMoveTime", -1.0f);
DluAssert(m_Platforms.insert(std::make_pair(tableData.getIntField("id", -1), entry)).second);
tableData.nextRow();
}
}
const std::optional<CDMovingPlatformTableEntry> CDMovingPlatformComponentTable::GetPlatformEntry(ComponentID id) {
auto itr = m_Platforms.find(id);
if (itr == m_Platforms.end()) {
CachePlatformEntry(id);
itr = m_Platforms.find(id);
}
return itr != m_Platforms.end() ? std::make_optional<CDMovingPlatformTableEntry>(itr->second) : std::nullopt;
}

View File

@@ -0,0 +1,27 @@
#ifndef __CDMOVINGPLATFORMCOMPONENTTABLE__H__
#define __CDMOVINGPLATFORMCOMPONENTTABLE__H__
#include "CDTable.h"
#include "NiPoint3.h"
#include <optional>
typedef uint32_t ComponentID;
struct CDMovingPlatformTableEntry {
NiPoint3 platformMove;
float moveTime;
bool platformIsSimpleMover;
bool platformStartAtEnd;
};
class CDMovingPlatformComponentTable : public CDTable<CDMovingPlatformComponentTable> {
public:
CDMovingPlatformComponentTable();
void CachePlatformEntry(ComponentID id);
const std::optional<CDMovingPlatformTableEntry> GetPlatformEntry(ComponentID id);
private:
std::map<ComponentID, CDMovingPlatformTableEntry> m_Platforms;
};
#endif //!__CDMOVINGPLATFORMCOMPONENTTABLE__H__

View File

@@ -0,0 +1,43 @@
#include "CDObjectSkillsTable.h"
void CDObjectSkillsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ObjectSkills");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ObjectSkills");
while (!tableData.eof()) {
CDObjectSkills entry;
entry.objectTemplate = tableData.getIntField("objectTemplate", -1);
entry.skillID = tableData.getIntField("skillID", -1);
entry.castOnType = tableData.getIntField("castOnType", -1);
entry.AICombatWeight = tableData.getIntField("AICombatWeight", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) {
std::vector<CDObjectSkills> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,19 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDObjectSkills {
uint32_t objectTemplate; //!< The LOT of the item
uint32_t skillID; //!< The Skill ID of the object
uint32_t castOnType; //!< ???
uint32_t AICombatWeight; //!< ???
};
class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable, std::vector<CDObjectSkills>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
};

View File

@@ -0,0 +1,95 @@
#include "CDObjectsTable.h"
namespace {
CDObjects m_default;
};
void CDObjectsTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Objects");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Objects");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDObjects entry;
entry.id = tableData.getIntField("id", -1);
entry.name = tableData.getStringField("name", "");
UNUSED_COLUMN(entry.placeable = tableData.getIntField("placeable", -1);)
entry.type = tableData.getStringField("type", "");
UNUSED_COLUMN(entry.description = tableData.getStringField("description", "");)
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1);)
UNUSED_COLUMN(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1);)
UNUSED_COLUMN(entry.displayName = tableData.getStringField("displayName", "");)
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
UNUSED_COLUMN(entry.nametag = tableData.getIntField("nametag", -1);)
UNUSED_COLUMN(entry._internalNotes = tableData.getStringField("_internalNotes", "");)
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1);)
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", "");)
UNUSED_COLUMN(entry.HQ_valid = tableData.getIntField("HQ_valid", -1);)
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
m_default.id = 0;
}
const CDObjects& CDObjectsTable::GetByID(uint32_t LOT) {
auto& entries = GetEntriesMutable();
const auto& it = entries.find(LOT);
if (it != entries.end()) {
return it->second;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Objects WHERE id = ?;");
query.bind(1, static_cast<int32_t>(LOT));
auto tableData = query.execQuery();
if (tableData.eof()) {
entries.insert(std::make_pair(LOT, m_default));
return m_default;
}
// Now get the data
while (!tableData.eof()) {
CDObjects entry;
entry.id = tableData.getIntField("id", -1);
entry.name = tableData.getStringField("name", "");
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
entry.type = tableData.getStringField("type", "");
UNUSED(ntry.description = tableData.getStringField(4, ""));
UNUSED(entry.localize = tableData.getIntField("localize", -1));
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
UNUSED(entry.displayName = tableData.getStringField("displayName", ""));
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
UNUSED(entry.nametag = tableData.getIntField("nametag", -1));
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
const auto& it2 = entries.find(LOT);
if (it2 != entries.end()) {
return it2->second;
}
return m_default;
}

View File

@@ -0,0 +1,29 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDObjects {
uint32_t id; //!< The LOT of the object
std::string name; //!< The internal name of the object
UNUSED(uint32_t placeable); //!< Whether or not the object is placable
std::string type; //!< The object type
UNUSED(std::string description); //!< An internal description of the object
UNUSED(uint32_t localize); //!< Whether or not the object should localize
UNUSED(uint32_t npcTemplateID); //!< Something related to NPCs...
UNUSED(std::string displayName); //!< The display name of the object
float interactionDistance; //!< The interaction distance of the object
UNUSED(uint32_t nametag); //!< ???
UNUSED(std::string _internalNotes); //!< Some internal notes (rarely used)
UNUSED(uint32_t locStatus); //!< ???
UNUSED(std::string gate_version); //!< The gate version for the object
UNUSED(uint32_t HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
};
class CDObjectsTable : public CDTable<CDObjectsTable, std::map<uint32_t, CDObjects>> {
public:
void LoadValuesFromDatabase();
// Gets an entry by ID
const CDObjects& GetByID(uint32_t LOT);
};

View File

@@ -0,0 +1,42 @@
#include "CDPackageComponentTable.h"
void CDPackageComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PackageComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PackageComponent");
while (!tableData.eof()) {
CDPackageComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entry.packageType = tableData.getIntField("packageType", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
//! Queries the table with a custom "where" clause
std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) {
std::vector<CDPackageComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,17 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDPackageComponent {
uint32_t id;
uint32_t LootMatrixIndex;
uint32_t packageType;
};
class CDPackageComponentTable : public CDTable<CDPackageComponentTable, std::vector<CDPackageComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate);
};

View File

@@ -0,0 +1,64 @@
#include "CDPetComponentTable.h"
namespace {
// Default entries for fallback
CDPetComponent defaultEntry{
.id = 0,
UNUSED_ENTRY(.minTameUpdateTime = 60.0f,)
UNUSED_ENTRY(.maxTameUpdateTime = 300.0f,)
UNUSED_ENTRY(.percentTameChance = 101.0f,)
UNUSED_ENTRY(.tameability = 100.0f,)
UNUSED_ENTRY(.elementType = 1,)
.walkSpeed = 2.5f,
.runSpeed = 5.0f,
.sprintSpeed = 10.0f,
UNUSED_ENTRY(.idleTimeMin = 60.0f,)
UNUSED_ENTRY(.idleTimeMax = 300.0f,)
UNUSED_ENTRY(.petForm = 0,)
.imaginationDrainRate = 60.0f,
UNUSED_ENTRY(.AudioMetaEventSet = "",)
UNUSED_ENTRY(.buffIDs = "",)
};
}
void CDPetComponentTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PetComponent");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
const uint32_t componentID = tableData.getIntField("id", defaultEntry.id);
auto& entry = entries[componentID];
entry.id = componentID;
UNUSED_COLUMN(entry.minTameUpdateTime = tableData.getFloatField("minTameUpdateTime", defaultEntry.minTameUpdateTime));
UNUSED_COLUMN(entry.maxTameUpdateTime = tableData.getFloatField("maxTameUpdateTime", defaultEntry.maxTameUpdateTime));
UNUSED_COLUMN(entry.percentTameChance = tableData.getFloatField("percentTameChance", defaultEntry.percentTameChance));
UNUSED_COLUMN(entry.tameability = tableData.getFloatField("tamability", defaultEntry.tameability)); // Mispelled as "tamability" in CDClient
UNUSED_COLUMN(entry.elementType = tableData.getIntField("elementType", defaultEntry.elementType));
entry.walkSpeed = static_cast<float>(tableData.getFloatField("walkSpeed", defaultEntry.walkSpeed));
entry.runSpeed = static_cast<float>(tableData.getFloatField("runSpeed", defaultEntry.runSpeed));
entry.sprintSpeed = static_cast<float>(tableData.getFloatField("sprintSpeed", defaultEntry.sprintSpeed));
UNUSED_COLUMN(entry.idleTimeMin = tableData.getFloatField("idleTimeMin", defaultEntry.idleTimeMin));
UNUSED_COLUMN(entry.idleTimeMax = tableData.getFloatField("idleTimeMax", defaultEntry.idleTimeMax));
UNUSED_COLUMN(entry.petForm = tableData.getIntField("petForm", defaultEntry.petForm));
entry.imaginationDrainRate = static_cast<float>(tableData.getFloatField("imaginationDrainRate", defaultEntry.imaginationDrainRate));
UNUSED_COLUMN(entry.AudioMetaEventSet = tableData.getStringField("AudioMetaEventSet", defaultEntry.AudioMetaEventSet));
UNUSED_COLUMN(entry.buffIDs = tableData.getStringField("buffIDs", defaultEntry.buffIDs));
tableData.nextRow();
}
}
void CDPetComponentTable::LoadValuesFromDefaults() {
GetEntriesMutable().insert(std::make_pair(defaultEntry.id, defaultEntry));
}
CDPetComponent& CDPetComponentTable::GetByID(const uint32_t componentID) {
auto& entries = GetEntriesMutable();
auto itr = entries.find(componentID);
if (itr == entries.end()) {
LOG("Unable to load pet component (ID %i) values from database! Using default values instead.", componentID);
return defaultEntry;
}
return itr->second;
}

View File

@@ -0,0 +1,42 @@
#pragma once
#include "CDTable.h"
#include <cstdint>
#include <string>
struct CDPetComponent {
uint32_t id;
UNUSED_COLUMN(float minTameUpdateTime;)
UNUSED_COLUMN(float maxTameUpdateTime;)
UNUSED_COLUMN(float percentTameChance;)
UNUSED_COLUMN(float tameability;) // Mispelled as "tamability" in CDClient
UNUSED_COLUMN(uint32_t elementType;)
float walkSpeed;
float runSpeed;
float sprintSpeed;
UNUSED_COLUMN(float idleTimeMin;)
UNUSED_COLUMN(float idleTimeMax;)
UNUSED_COLUMN(uint32_t petForm;)
float imaginationDrainRate;
UNUSED_COLUMN(std::string AudioMetaEventSet;)
UNUSED_COLUMN(std::string buffIDs;)
};
class CDPetComponentTable : public CDTable<CDPetComponentTable, std::map<uint32_t, CDPetComponent>> {
public:
/**
* Load values from the CD client database
*/
void LoadValuesFromDatabase();
/**
* Load the default values into memory instead of attempting to connect to the CD client database
*/
void LoadValuesFromDefaults();
/**
* Gets the pet component table corresponding to the pet component ID
* @returns A reference to the corresponding table, or the default if one could not be found
*/
CDPetComponent& GetByID(const uint32_t componentID);
};

View File

@@ -0,0 +1,37 @@
#include "CDPhysicsComponentTable.h"
void CDPhysicsComponentTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDPhysicsComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.bStatic = tableData.getIntField("static", -1) != 0;
entry.physicsAsset = tableData.getStringField("physics_asset", "");
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
entry.speed = tableData.getFloatField("speed", -1);
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
entry.playerHeight = tableData.getFloatField("playerHeight");
entry.playerRadius = tableData.getFloatField("playerRadius");
entry.pcShapeType = tableData.getIntField("pcShapeType");
entry.collisionGroup = tableData.getIntField("collisionGroup");
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
UNUSED(entry->friction = tableData.getFloatField("friction"));
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
}
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(uint32_t componentID) {
auto& entries = GetEntriesMutable();
auto itr = entries.find(componentID);
return itr != entries.end() ? &itr->second : nullptr;
}

View File

@@ -0,0 +1,30 @@
#pragma once
#include "CDTable.h"
#include <string>
struct CDPhysicsComponent {
int32_t id;
bool bStatic;
std::string physicsAsset;
UNUSED(bool jump);
UNUSED(bool doublejump);
float speed;
UNUSED(float rotSpeed);
float playerHeight;
float playerRadius;
int32_t pcShapeType;
int32_t collisionGroup;
UNUSED(float airSpeed);
UNUSED(std::string boundaryAsset);
UNUSED(float jumpAirSpeed);
UNUSED(float friction);
UNUSED(std::string gravityVolumeAsset);
};
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable, std::map<uint32_t, CDPhysicsComponent>> {
public:
void LoadValuesFromDatabase();
static const std::string GetTableName() { return "PhysicsComponent"; };
CDPhysicsComponent* GetByID(uint32_t componentID);
};

View File

@@ -0,0 +1,46 @@
#include "CDPropertyEntranceComponentTable.h"
namespace {
CDPropertyEntranceComponent defaultEntry{};
};
void CDPropertyEntranceComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
size_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyEntranceComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
auto& entries = GetEntriesMutable();
entries.reserve(size);
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyEntranceComponent;");
while (!tableData.eof()) {
auto entry = CDPropertyEntranceComponent{
static_cast<uint32_t>(tableData.getIntField("id", -1)),
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
tableData.getStringField("propertyName", ""),
static_cast<bool>(tableData.getIntField("isOnProperty", false)),
tableData.getStringField("groupType", "")
};
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
for (const auto& entry : GetEntries()) {
if (entry.id == id)
return entry;
}
return defaultEntry;
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include "CDTable.h"
struct CDPropertyEntranceComponent {
uint32_t id;
uint32_t mapID;
std::string propertyName;
bool isOnProperty;
std::string groupType;
};
class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable, std::vector<CDPropertyEntranceComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
CDPropertyEntranceComponent GetByID(uint32_t id);
};

View File

@@ -0,0 +1,46 @@
#include "CDPropertyTemplateTable.h"
namespace {
CDPropertyTemplate defaultEntry{};
};
void CDPropertyTemplateTable::LoadValuesFromDatabase() {
// First, get the size of the table
size_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyTemplate;");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
auto& entries = GetEntriesMutable();
entries.reserve(size);
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyTemplate;");
while (!tableData.eof()) {
auto entry = CDPropertyTemplate{
static_cast<uint32_t>(tableData.getIntField("id", -1)),
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
static_cast<uint32_t>(tableData.getIntField("vendorMapID", -1)),
tableData.getStringField("spawnName", "")
};
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
for (const auto& entry : GetEntries()) {
if (entry.mapID == mapID)
return entry;
}
return defaultEntry;
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include "CDTable.h"
struct CDPropertyTemplate {
uint32_t id;
uint32_t mapID;
uint32_t vendorMapID;
std::string spawnName;
};
class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable, std::vector<CDPropertyTemplate>> {
public:
void LoadValuesFromDatabase();
CDPropertyTemplate GetByMapID(uint32_t mapID);
};

View File

@@ -0,0 +1,43 @@
#include "CDProximityMonitorComponentTable.h"
void CDProximityMonitorComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ProximityMonitorComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ProximityMonitorComponent");
while (!tableData.eof()) {
CDProximityMonitorComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.Proximities = tableData.getStringField("Proximities", "");
entry.LoadOnClient = tableData.getIntField("LoadOnClient", -1);
entry.LoadOnServer = tableData.getIntField("LoadOnServer", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query(std::function<bool(CDProximityMonitorComponent)> predicate) {
std::vector<CDProximityMonitorComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,18 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDProximityMonitorComponent {
uint32_t id;
std::string Proximities;
bool LoadOnClient;
bool LoadOnServer;
};
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable, std::vector<CDProximityMonitorComponent>> {
public:
void LoadValuesFromDatabase();
//! Queries the table with a custom "where" clause
std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate);
};

View File

@@ -0,0 +1,64 @@
#include "CDRailActivatorComponent.h"
#include "GeneralUtils.h"
void CDRailActivatorComponentTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RailActivatorComponent;");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDRailActivatorComponent entry;
entry.id = tableData.getIntField("id", 0);
entry.startAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startAnim", ""));
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopAnim", ""));
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopAnim", ""));
entry.startSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startSound", ""));
entry.loopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopSound", ""));
entry.stopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopSound", ""));
std::string loopEffectString(tableData.getStringField("effectIDs", ""));
entry.loopEffectID = EffectPairFromString(loopEffectString);
entry.preconditions = tableData.getStringField("preconditions", "-1");
entry.playerCollision = tableData.getIntField("playerCollision", 0);
entry.cameraLocked = tableData.getIntField("cameraLocked", 0);
std::string startEffectString(tableData.getStringField("StartEffectID", ""));
entry.startEffectID = EffectPairFromString(startEffectString);
std::string stopEffectString(tableData.getStringField("StopEffectID", ""));
entry.stopEffectID = EffectPairFromString(stopEffectString);
entry.damageImmune = tableData.getIntField("DamageImmune", 0);
entry.noAggro = tableData.getIntField("NoAggro", 0);
entry.showNameBillboard = tableData.getIntField("ShowNameBillboard", 0);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
for (const auto& entry : GetEntries()) {
if (entry.id == id)
return entry;
}
return {};
}
std::pair<uint32_t, std::u16string> CDRailActivatorComponentTable::EffectPairFromString(std::string& str) {
const auto split = GeneralUtils::SplitString(str, ':');
if (split.size() == 2) {
return { std::stoi(split.at(0)), GeneralUtils::ASCIIToUTF16(split.at(1)) };
}
return {};
}

View File

@@ -0,0 +1,29 @@
#pragma once
#include "CDTable.h"
struct CDRailActivatorComponent {
int32_t id;
std::u16string startAnimation;
std::u16string loopAnimation;
std::u16string stopAnimation;
std::u16string startSound;
std::u16string loopSound;
std::u16string stopSound;
std::pair<uint32_t, std::u16string> startEffectID;
std::pair<uint32_t, std::u16string> loopEffectID;
std::pair<uint32_t, std::u16string> stopEffectID;
std::string preconditions;
bool playerCollision;
bool cameraLocked;
bool damageImmune;
bool noAggro;
bool showNameBillboard;
};
class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable, std::vector<CDRailActivatorComponent>> {
public:
void LoadValuesFromDatabase();
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
private:
static std::pair<uint32_t, std::u16string> EffectPairFromString(std::string& str);
};

View File

@@ -0,0 +1,35 @@
#include "CDRarityTableTable.h"
void CDRarityTableTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RarityTable");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RarityTable order by randmax desc;");
while (!tableData.eof()) {
uint32_t rarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
CDRarityTable entry;
entry.randmax = tableData.getFloatField("randmax", -1);
entry.rarity = tableData.getIntField("rarity", -1);
entries[rarityTableIndex].push_back(entry);
tableData.nextRow();
}
}
const std::vector<CDRarityTable>& CDRarityTableTable::GetRarityTable(uint32_t id) {
return GetEntriesMutable()[id];
}

View File

@@ -0,0 +1,21 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDRarityTable {
float randmax;
uint32_t rarity;
typedef uint32_t Index;
};
typedef std::vector<CDRarityTable> RarityTable;
class CDRarityTableTable : public CDTable<CDRarityTableTable, std::unordered_map<CDRarityTable::Index, std::vector<CDRarityTable>>> {
public:
void LoadValuesFromDatabase();
const std::vector<CDRarityTable>& GetRarityTable(uint32_t predicate);
};

View File

@@ -0,0 +1,49 @@
#include "CDRebuildComponentTable.h"
void CDRebuildComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RebuildComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RebuildComponent");
while (!tableData.eof()) {
CDRebuildComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.reset_time = tableData.getFloatField("reset_time", -1.0f);
entry.complete_time = tableData.getFloatField("complete_time", -1.0f);
entry.take_imagination = tableData.getIntField("take_imagination", -1);
entry.interruptible = tableData.getIntField("interruptible", -1) == 1 ? true : false;
entry.self_activator = tableData.getIntField("self_activator", -1) == 1 ? true : false;
entry.custom_modules = tableData.getStringField("custom_modules", "");
entry.activityID = tableData.getIntField("activityID", -1);
entry.post_imagination_cost = tableData.getIntField("post_imagination_cost", -1);
entry.time_before_smash = tableData.getFloatField("time_before_smash", -1.0f);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) {
std::vector<CDRebuildComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,25 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDRebuildComponent {
uint32_t id; //!< The component Id
float reset_time; //!< The reset time
float complete_time; //!< The complete time
uint32_t take_imagination; //!< The amount of imagination it costs
bool interruptible; //!< Whether or not the rebuild is interruptible
bool self_activator; //!< Whether or not the rebuild is a rebuild activator itself
std::string custom_modules; //!< The custom modules
uint32_t activityID; //!< The activity ID
uint32_t post_imagination_cost; //!< The post imagination cost
float time_before_smash; //!< The time before smash
};
class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable, std::vector<CDRebuildComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
};

View File

@@ -0,0 +1,48 @@
#include "CDRewardCodesTable.h"
void CDRewardCodesTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RewardCodes");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RewardCodes");
while (!tableData.eof()) {
CDRewardCode entry;
entry.id = tableData.getIntField("id", -1);
entry.code = tableData.getStringField("code", "");
entry.attachmentLOT = tableData.getIntField("attachmentLOT", -1);
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
entries.push_back(entry);
tableData.nextRow();
}
}
LOT CDRewardCodesTable::GetAttachmentLOT(uint32_t rewardCodeId) const {
for (auto const &entry : GetEntries()){
if (rewardCodeId == entry.id) return entry.attachmentLOT;
}
return LOT_NULL;
}
uint32_t CDRewardCodesTable::GetCodeID(std::string code) const {
for (auto const &entry : GetEntries()){
if (code == entry.code) return entry.id;
}
return -1;
}

View File

@@ -0,0 +1,21 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDRewardCode {
uint32_t id;
std::string code;
LOT attachmentLOT;
UNUSED(uint32_t locStatus);
UNUSED(std::string gate_version);
};
class CDRewardCodesTable : public CDTable<CDRewardCodesTable, std::vector<CDRewardCode>> {
public:
void LoadValuesFromDatabase();
LOT GetAttachmentLOT(uint32_t rewardCodeId) const;
uint32_t GetCodeID(std::string code) const;
};

View File

@@ -0,0 +1,30 @@
#include "CDRewardsTable.h"
void CDRewardsTable::LoadValuesFromDatabase() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDRewards entry;
entry.id = tableData.getIntField("id", -1);
entry.levelID = tableData.getIntField("LevelID", -1);
entry.missionID = tableData.getIntField("MissionID", -1);
entry.rewardType = tableData.getIntField("RewardType", -1);
entry.value = tableData.getIntField("value", -1);
entry.count = tableData.getIntField("count", -1);
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
}
std::vector<CDRewards> CDRewardsTable::GetByLevelID(uint32_t levelID) {
std::vector<CDRewards> result{};
for (const auto& e : GetEntries()) {
if (e.second.levelID == levelID) result.push_back(e.second);
}
return result;
}

View File

@@ -0,0 +1,19 @@
#pragma once
#include "CDTable.h"
#include <string>
struct CDRewards {
int32_t id;
int32_t levelID;
int32_t missionID;
int32_t rewardType;
int32_t value;
int32_t count;
};
class CDRewardsTable : public CDTable<CDRewardsTable, std::map<uint32_t, CDRewards>> {
public:
void LoadValuesFromDatabase();
std::vector<CDRewards> GetByLevelID(uint32_t levelID);
};

View File

@@ -0,0 +1,45 @@
#include "CDScriptComponentTable.h"
namespace {
CDScriptComponent m_ToReturnWhenNoneFound;
};
void CDScriptComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ScriptComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ScriptComponent");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDScriptComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.script_name = tableData.getStringField("script_name", "");
entry.client_script_name = tableData.getStringField("client_script_name", "");
entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();
}
tableData.finalize();
}
const CDScriptComponent& CDScriptComponentTable::GetByID(uint32_t id) {
auto& entries = GetEntries();
auto it = entries.find(id);
if (it != entries.end()) {
return it->second;
}
return m_ToReturnWhenNoneFound;
}

View File

@@ -0,0 +1,18 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDScriptComponent {
uint32_t id; //!< The component ID
std::string script_name; //!< The script name
std::string client_script_name; //!< The client script name
};
class CDScriptComponentTable : public CDTable<CDScriptComponentTable, std::map<uint32_t, CDScriptComponent>> {
public:
void LoadValuesFromDatabase();
// Gets an entry by scriptID
const CDScriptComponent& GetByID(uint32_t id);
};

View File

@@ -0,0 +1,62 @@
#include "CDSkillBehaviorTable.h"
namespace {
CDSkillBehavior m_empty = CDSkillBehavior();
};
void CDSkillBehaviorTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM SkillBehavior");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
auto& entries = GetEntriesMutable();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM SkillBehavior");
while (!tableData.eof()) {
CDSkillBehavior entry;
entry.skillID = tableData.getIntField("skillID", -1);
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.behaviorID = tableData.getIntField("behaviorID", -1);
entry.imaginationcost = tableData.getIntField("imaginationcost", -1);
entry.cooldowngroup = tableData.getIntField("cooldowngroup", -1);
entry.cooldown = tableData.getFloatField("cooldown", -1.0f);
UNUSED(entry.isNpcEditor = tableData.getIntField("isNpcEditor", -1) == 1 ? true : false);
UNUSED(entry.skillIcon = tableData.getIntField("skillIcon", -1));
UNUSED(entry.oomSkillID = tableData.getStringField("oomSkillID", ""));
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField("oomBehaviorEffectID", -1));
UNUSED(entry.castTypeDesc = tableData.getIntField("castTypeDesc", -1));
UNUSED(entry.imBonusUI = tableData.getIntField("imBonusUI", -1));
UNUSED(entry.lifeBonusUI = tableData.getIntField("lifeBonusUI", -1));
UNUSED(entry.armorBonusUI = tableData.getIntField("armorBonusUI", -1));
UNUSED(entry.damageUI = tableData.getIntField("damageUI", -1));
UNUSED(entry.hideIcon = tableData.getIntField("hideIcon", -1) == 1 ? true : false);
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.cancelType = tableData.getIntField("cancelType", -1));
entries.insert(std::make_pair(entry.skillID, entry));
//this->entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
const CDSkillBehavior& CDSkillBehaviorTable::GetSkillByID(uint32_t skillID) {
auto& entries = GetEntries();
auto it = entries.find(skillID);
if (it != entries.end()) {
return it->second;
}
return m_empty;
}

View File

@@ -0,0 +1,35 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDSkillBehavior {
uint32_t skillID; //!< The Skill ID of the skill
UNUSED(uint32_t locStatus); //!< ??
uint32_t behaviorID; //!< The Behavior ID of the skill
uint32_t imaginationcost; //!< The imagination cost of the skill
uint32_t cooldowngroup; //!< The cooldown group ID of the skill
float cooldown; //!< The cooldown time of the skill
UNUSED(bool isNpcEditor); //!< ???
UNUSED(uint32_t skillIcon); //!< The Skill Icon ID
UNUSED(std::string oomSkillID); //!< ???
UNUSED(uint32_t oomBehaviorEffectID); //!< ???
UNUSED(uint32_t castTypeDesc); //!< The cast type description(?)
UNUSED(uint32_t imBonusUI); //!< The imagination bonus of the skill
UNUSED(nint32_t lifeBonusUI); //!< The life bonus of the skill
UNUSED(uint32_t armorBonusUI); //!< The armor bonus of the skill
UNUSED(uint32_t damageUI); //!< ???
UNUSED(bool hideIcon); //!< Whether or not to show the icon
UNUSED(bool localize); //!< ???
UNUSED(std::string gate_version); //!< ???
UNUSED(uint32_t cancelType); //!< The cancel type (?)
};
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable, std::map<uint32_t, CDSkillBehavior>> {
public:
void LoadValuesFromDatabase();
// Gets an entry by skillID
const CDSkillBehavior& GetSkillByID(uint32_t skillID);
};

View File

@@ -0,0 +1,50 @@
#pragma once
#include "CDClientDatabase.h"
#include "CDClientManager.h"
#include "Singleton.h"
#include "DluAssert.h"
#include <functional>
#include <string>
#include <vector>
#include <map>
#include <cstdint>
// CPPLinq
#ifdef _WIN32
#define NOMINMAX
// windows.h has min and max macros that breaks cpplinq
#endif
#include "cpplinq.hpp"
// Used for legacy
#define UNUSED(x)
// Enable this to skip some unused columns in some tables
#define UNUSED_COLUMN(v)
// Use this to skip unused defaults for unused entries in some tables
#define UNUSED_ENTRY(v, x)
#pragma warning (disable : 4244) //Disable double to float conversion warnings
// #pragma warning (disable : 4715) //Disable "not all control paths return a value"
template<class Table, typename Storage>
class CDTable : public Singleton<Table> {
public:
typedef Storage StorageType;
protected:
virtual ~CDTable() = default;
// If you need these for a specific table, override it such that there is a public variant.
[[nodiscard]] StorageType& GetEntriesMutable() const {
return CDClientManager::GetEntriesMutable<Table>();
}
// If you need these for a specific table, override it such that there is a public variant.
[[nodiscard]] const StorageType& GetEntries() const {
return GetEntriesMutable();
}
};

View File

@@ -0,0 +1,45 @@
#include "CDVendorComponentTable.h"
void CDVendorComponentTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM VendorComponent");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
auto& entries = GetEntriesMutable();
entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM VendorComponent");
while (!tableData.eof()) {
CDVendorComponent entry;
entry.id = tableData.getIntField("id", -1);
entry.buyScalar = tableData.getFloatField("buyScalar", 0.0f);
entry.sellScalar = tableData.getFloatField("sellScalar", -1.0f);
entry.refreshTimeSeconds = tableData.getFloatField("refreshTimeSeconds", -1.0f);
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
//! Queries the table with a custom "where" clause
std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) {
std::vector<CDVendorComponent> data = cpplinq::from(GetEntries())
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}

View File

@@ -0,0 +1,20 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDVendorComponent {
uint32_t id; //!< The Component ID
float buyScalar; //!< Buy Scalar (what does that mean?)
float sellScalar; //!< Sell Scalar (what does that mean?)
float refreshTimeSeconds; //!< The refresh time
uint32_t LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
};
class CDVendorComponentTable : public CDTable<CDVendorComponentTable, std::vector<CDVendorComponent>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a custom "where" clause
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
};

View File

@@ -0,0 +1,67 @@
#include "CDZoneTableTable.h"
void CDZoneTableTable::LoadValuesFromDatabase() {
// First, get the size of the table
uint32_t size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ZoneTable");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ZoneTable");
auto& entries = GetEntriesMutable();
while (!tableData.eof()) {
CDZoneTable entry;
entry.zoneID = tableData.getIntField("zoneID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.zoneName = tableData.getStringField("zoneName", "");
entry.scriptID = tableData.getIntField("scriptID", -1);
entry.ghostdistance_min = tableData.getFloatField("ghostdistance_min", -1.0f);
entry.ghostdistance = tableData.getFloatField("ghostdistance", -1.0f);
entry.population_soft_cap = tableData.getIntField("population_soft_cap", -1);
entry.population_hard_cap = tableData.getIntField("population_hard_cap", -1);
UNUSED(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
UNUSED(entry.mapFolder = tableData.getStringField("mapFolder", ""));
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", "");
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
entry.petsAllowed = tableData.getIntField("petsAllowed", -1) == 1 ? true : false;
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false;
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false;
entries.insert(std::make_pair(entry.zoneID, entry));
tableData.nextRow();
}
tableData.finalize();
}
//! Queries the table with a zoneID to find.
const CDZoneTable* CDZoneTableTable::Query(uint32_t zoneID) {
auto& m_Entries = GetEntries();
const auto& iter = m_Entries.find(zoneID);
if (iter != m_Entries.end()) {
return &iter->second;
}
return nullptr;
}

View File

@@ -0,0 +1,42 @@
#pragma once
// Custom Classes
#include "CDTable.h"
struct CDZoneTable {
uint32_t zoneID; //!< The Zone ID of the object
uint32_t locStatus; //!< The Locale Status(?)
std::string zoneName; //!< The name of the zone
uint32_t scriptID; //!< The Script ID of the zone (ScriptsTable)
float ghostdistance_min; //!< The minimum ghosting distance
float ghostdistance; //!< The ghosting distance
uint32_t population_soft_cap; //!< The "soft cap" on the world population
uint32_t population_hard_cap; //!< The "hard cap" on the world population
UNUSED(std::string DisplayDescription); //!< The display description of the world
UNUSED(std::string mapFolder); //!< ???
float smashableMinDistance; //!< The minimum smashable distance?
float smashableMaxDistance; //!< The maximum smashable distance?
UNUSED(std::string mixerProgram); //!< ???
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
std::string serverPhysicsFramerate; //!< The server physics framerate
uint32_t zoneControlTemplate; //!< The Zone Control template
uint32_t widthInChunks; //!< The width of the world in chunks
uint32_t heightInChunks; //!< The height of the world in chunks
bool petsAllowed; //!< Whether or not pets are allowed in the world
bool localize; //!< Whether or not the world should be localized
float fZoneWeight; //!< ???
UNUSED(std::string thumbnail); //!< The thumbnail of the world
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
bool disableSaveLoc; //!< Disables the saving location?
float teamRadius; //!< ???
UNUSED(std::string gate_version); //!< The gate version
bool mountsAllowed; //!< Whether or not mounts are allowed
};
class CDZoneTableTable : public CDTable<CDZoneTableTable, std::map<uint32_t, CDZoneTable>> {
public:
void LoadValuesFromDatabase();
// Queries the table with a zoneID to find.
const CDZoneTable* Query(uint32_t zoneID);
};

View File

@@ -0,0 +1,41 @@
set(DDATABASE_CDCLIENTDATABASE_CDCLIENTTABLES_SOURCES "CDActivitiesTable.cpp"
"CDActivityRewardsTable.cpp"
"CDAnimationsTable.cpp"
"CDBehaviorParameterTable.cpp"
"CDBehaviorTemplateTable.cpp"
"CDBrickIDTableTable.cpp"
"CDComponentsRegistryTable.cpp"
"CDCurrencyTableTable.cpp"
"CDDestructibleComponentTable.cpp"
"CDEmoteTable.cpp"
"CDFeatureGatingTable.cpp"
"CDInventoryComponentTable.cpp"
"CDItemComponentTable.cpp"
"CDItemSetSkillsTable.cpp"
"CDItemSetsTable.cpp"
"CDLevelProgressionLookupTable.cpp"
"CDLootMatrixTable.cpp"
"CDLootTableTable.cpp"
"CDMovingPlatformComponentTable.cpp"
"CDMissionEmailTable.cpp"
"CDMissionNPCComponentTable.cpp"
"CDMissionsTable.cpp"
"CDMissionTasksTable.cpp"
"CDMovementAIComponentTable.cpp"
"CDObjectSkillsTable.cpp"
"CDObjectsTable.cpp"
"CDPetComponentTable.cpp"
"CDPackageComponentTable.cpp"
"CDPhysicsComponentTable.cpp"
"CDPropertyEntranceComponentTable.cpp"
"CDPropertyTemplateTable.cpp"
"CDProximityMonitorComponentTable.cpp"
"CDRailActivatorComponent.cpp"
"CDRarityTableTable.cpp"
"CDRebuildComponentTable.cpp"
"CDRewardCodesTable.cpp"
"CDRewardsTable.cpp"
"CDScriptComponentTable.cpp"
"CDSkillBehaviorTable.cpp"
"CDVendorComponentTable.cpp"
"CDZoneTableTable.cpp" PARENT_SCOPE)

View File

@@ -0,0 +1,12 @@
set(DDATABASE_CDCLIENTDATABASE_SOURCES
"CDClientDatabase.cpp"
"CDClientManager.cpp"
)
add_subdirectory(CDClientTables)
foreach(file ${DDATABASE_CDCLIENTDATABASE_CDCLIENTTABLES_SOURCES})
set(DDATABASE_CDCLIENTDATABASE_SOURCES ${DDATABASE_CDCLIENTDATABASE_SOURCES} "CDClientTables/${file}")
endforeach()
set(DDATABASE_CDCLIENTDATABASE_SOURCES ${DDATABASE_CDCLIENTDATABASE_SOURCES} PARENT_SCOPE)