CDClient cleanup and optimization (#1023)

* CDClient cleanup and optimization

- Use static function to get table name
- Remove unused GetName function
- Replace above function with a static GetTableName function
- Remove verbose comments
- Remove verbose initializers
- Remove need to specify table name when getting a table by name
- Remove unused typedef for mac and linux

* Re-add unused table

Convert tables to singletons

- Convert all CDClient tables to singletons
- Move Singleton.h to dCommon
- Reduce header clutter in CDClientManager
This commit is contained in:
David Markowitz
2023-03-17 07:36:21 -07:00
committed by GitHub
parent bd79e9433c
commit 7671cc6865
121 changed files with 399 additions and 1584 deletions

View File

@@ -1,6 +1,5 @@
#include "CDActivitiesTable.h"
//! Constructor
CDActivitiesTable::CDActivitiesTable(void) {
// First, get the size of the table
@@ -48,15 +47,6 @@ CDActivitiesTable::CDActivitiesTable(void) {
tableData.finalize();
}
//! Destructor
CDActivitiesTable::~CDActivitiesTable(void) {}
//! Returns the table's name
std::string CDActivitiesTable::GetName(void) const {
return "Activities";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
std::vector<CDActivities> data = cpplinq::from(this->entries)
@@ -66,7 +56,6 @@ std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActiviti
return data;
}
//! Gets all the entries in the table
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDActivitiesTable.hpp
\brief Contains data for the Activities table
*/
//! Activities Entry Struct
struct CDActivities {
unsigned int ActivityID;
unsigned int locStatus;
@@ -31,36 +25,14 @@ struct CDActivities {
float optionalPercentage;
};
//! Activities table
class CDActivitiesTable : public CDTable {
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
private:
std::vector<CDActivities> entries;
public:
//! Constructor
CDActivitiesTable(void);
//! Destructor
~CDActivitiesTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDActivitiesTable();
// Queries the table with a custom "where" clause
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivities> GetEntries(void) const;
};

View File

@@ -1,6 +1,5 @@
#include "CDActivityRewardsTable.h"
//! Constructor
CDActivityRewardsTable::CDActivityRewardsTable(void) {
// First, get the size of the table
@@ -36,15 +35,6 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
tableData.finalize();
}
//! Destructor
CDActivityRewardsTable::~CDActivityRewardsTable(void) {}
//! Returns the table's name
std::string CDActivityRewardsTable::GetName(void) const {
return "ActivityRewards";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
@@ -54,7 +44,6 @@ std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(
return data;
}
//! Gets all the entries in the table
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDActivityRewardsTable.hpp
\brief Contains data for the ActivityRewards table
*/
//! ActivityRewards Entry Struct
struct CDActivityRewards {
unsigned int objectTemplate; //!< The object template (?)
unsigned int ActivityRewardIndex; //!< The activity reward index
@@ -19,36 +13,15 @@ struct CDActivityRewards {
std::string description; //!< The description
};
//! ActivityRewards table
class CDActivityRewardsTable : public CDTable {
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
private:
std::vector<CDActivityRewards> entries;
public:
//! Constructor
CDActivityRewardsTable(void);
//! Destructor
~CDActivityRewardsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDActivityRewardsTable();
// Queries the table with a custom "where" clause
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivityRewards> GetEntries(void) const;
};

View File

@@ -1,6 +1,5 @@
#include "CDAnimationsTable.h"
//! Constructor
CDAnimationsTable::CDAnimationsTable(void) {
// First, get the size of the table
@@ -42,15 +41,6 @@ CDAnimationsTable::CDAnimationsTable(void) {
tableData.finalize();
}
//! Destructor
CDAnimationsTable::~CDAnimationsTable(void) {}
//! Returns the table's name
std::string CDAnimationsTable::GetName(void) const {
return "Animations";
}
//! Queries the table with a custom "where" clause
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
std::vector<CDAnimations> data = cpplinq::from(this->entries)
@@ -60,7 +50,6 @@ std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimatio
return data;
}
//! Gets all the entries in the table
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDAnimationsTable.hpp
\brief Contains data for the Animations table
*/
//! Animations Entry Struct
struct CDAnimations {
unsigned int animationGroupID; //!< The animation group ID
std::string animation_type; //!< The animation type
@@ -26,35 +20,14 @@ struct CDAnimations {
};
//! Animations table
class CDAnimationsTable : public CDTable {
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
private:
std::vector<CDAnimations> entries;
public:
//! Constructor
CDAnimationsTable(void);
//! Destructor
~CDAnimationsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDAnimationsTable();
// Queries the table with a custom "where" clause
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDAnimations> GetEntries(void) const;
};

View File

@@ -1,7 +1,6 @@
#include "CDBehaviorParameterTable.h"
#include "GeneralUtils.h"
//! Constructor
CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
uint32_t uniqueParameterId = 0;
@@ -28,14 +27,6 @@ CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
tableData.finalize();
}
//! Destructor
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) {}
//! Returns the table's name
std::string CDBehaviorParameterTable::GetName(void) const {
return "BehaviorParameter";
}
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
auto parameterID = this->m_ParametersList.find(name);
if (parameterID == this->m_ParametersList.end()) return defaultValue;

View File

@@ -5,37 +5,18 @@
#include <unordered_map>
#include <unordered_set>
/*!
\file CDBehaviorParameterTable.hpp
\brief Contains data for the BehaviorParameter table
*/
//! BehaviorParameter Entry Struct
struct CDBehaviorParameter {
unsigned int behaviorID; //!< The Behavior ID
std::unordered_map<std::string, uint32_t>::iterator parameterID; //!< The Parameter ID
float value; //!< The value of the behavior template
};
//! BehaviorParameter table
class CDBehaviorParameterTable : public CDTable {
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
private:
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
std::unordered_map<std::string, uint32_t> m_ParametersList;
public:
//! Constructor
CDBehaviorParameterTable(void);
//! Destructor
~CDBehaviorParameterTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
CDBehaviorParameterTable();
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

@@ -1,6 +1,5 @@
#include "CDBehaviorTemplateTable.h"
//! Constructor
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
// First, get the size of the table
@@ -40,15 +39,6 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
tableData.finalize();
}
//! Destructor
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) {}
//! Returns the table's name
std::string CDBehaviorTemplateTable::GetName(void) const {
return "BehaviorTemplate";
}
//! Queries the table with a custom "where" clause
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
@@ -58,7 +48,6 @@ std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<boo
return data;
}
//! Gets all the entries in the table
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -5,12 +5,6 @@
#include <unordered_map>
#include <unordered_set>
/*!
\file CDBehaviorTemplateTable.hpp
\brief Contains data for the BehaviorTemplate table
*/
//! BehaviorTemplate Entry Struct
struct CDBehaviorTemplate {
unsigned int behaviorID; //!< The Behavior ID
unsigned int templateID; //!< The Template ID (LOT)
@@ -19,36 +13,16 @@ struct CDBehaviorTemplate {
};
//! BehaviorTemplate table
class CDBehaviorTemplateTable : public CDTable {
class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable> {
private:
std::vector<CDBehaviorTemplate> entries;
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
std::unordered_set<std::string> m_EffectHandles;
public:
//! Constructor
CDBehaviorTemplateTable(void);
//! Destructor
~CDBehaviorTemplateTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDBehaviorTemplateTable();
// Queries the table with a custom "where" clause
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBehaviorTemplate> GetEntries(void) const;
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);

View File

@@ -1,6 +1,5 @@
#include "CDBrickIDTableTable.h"
//! Constructor
CDBrickIDTableTable::CDBrickIDTableTable(void) {
// First, get the size of the table
@@ -31,15 +30,6 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
tableData.finalize();
}
//! Destructor
CDBrickIDTableTable::~CDBrickIDTableTable(void) {}
//! Returns the table's name
std::string CDBrickIDTableTable::GetName(void) const {
return "BrickIDTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
std::vector<CDBrickIDTable> data = cpplinq::from(this->entries)
@@ -49,7 +39,6 @@ std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBric
return data;
}
//! Gets all the entries in the table
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -16,34 +16,14 @@ struct CDBrickIDTable {
//! BrickIDTable table
class CDBrickIDTableTable : public CDTable {
class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable> {
private:
std::vector<CDBrickIDTable> entries;
public:
//! Constructor
CDBrickIDTableTable(void);
//! Destructor
~CDBrickIDTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDBrickIDTableTable();
// Queries the table with a custom "where" clause
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBrickIDTable> GetEntries(void) const;
};

View File

@@ -3,7 +3,6 @@
#define CDCLIENT_CACHE_ALL
//! Constructor
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#ifdef CDCLIENT_CACHE_ALL
@@ -31,24 +30,6 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
//this->entries.push_back(entry);
/*
//Darwin's stuff:
const auto& it = this->mappedEntries.find(entry.id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(entry.component_type);
if (iter == it->second.end()) {
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
}
}
else {
std::map<unsigned int, unsigned int> map;
map.insert(std::make_pair(entry.component_type, entry.component_id));
this->mappedEntries.insert(std::make_pair(entry.id, map));
}
*/
tableData.nextRow();
}
@@ -56,14 +37,6 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#endif
}
//! Destructor
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) {}
//! Returns the table's name
std::string CDComponentsRegistryTable::GetName(void) const {
return "ComponentsRegistry";
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
@@ -73,16 +46,6 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
return iter->second;
/*
const auto& it = this->mappedEntries.find(id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(componentType);
if (iter != it->second.end()) {
return iter->second;
}
}
*/
#ifndef CDCLIENT_CACHE_ALL
// Now get the data
std::stringstream query;

View File

@@ -3,12 +3,7 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDComponentsRegistryTable.hpp
\brief Contains data for the ComponentsRegistry table
*/
enum class eReplicaComponentType : uint32_t;
//! ComponentsRegistry Entry Struct
struct CDComponentsRegistry {
unsigned int id; //!< The LOT is used as the ID
eReplicaComponentType component_type; //!< See ComponentTypes enum for values
@@ -16,25 +11,11 @@ struct CDComponentsRegistry {
};
//! ComponentsRegistry table
class CDComponentsRegistryTable : public CDTable {
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
private:
//std::vector<CDComponentsRegistry> entries;
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
public:
//! Constructor
CDComponentsRegistryTable(void);
//! Destructor
~CDComponentsRegistryTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
CDComponentsRegistryTable();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
};

View File

@@ -34,15 +34,6 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
tableData.finalize();
}
//! Destructor
CDCurrencyTableTable::~CDCurrencyTableTable(void) {}
//! Returns the table's name
std::string CDCurrencyTableTable::GetName(void) const {
return "CurrencyTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) {
std::vector<CDCurrencyTable> data = cpplinq::from(this->entries)
@@ -52,7 +43,6 @@ std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCu
return data;
}
//! Gets all the entries in the table
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -18,34 +18,14 @@ struct CDCurrencyTable {
};
//! CurrencyTable table
class CDCurrencyTableTable : public CDTable {
class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable> {
private:
std::vector<CDCurrencyTable> entries;
public:
//! Constructor
CDCurrencyTableTable(void);
//! Destructor
~CDCurrencyTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDCurrencyTableTable();
// Queries the table with a custom "where" clause
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDCurrencyTable> GetEntries(void) const;
};

View File

@@ -43,15 +43,6 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) {}
//! Returns the table's name
std::string CDDestructibleComponentTable::GetName(void) const {
return "DestructibleComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) {
std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries)
@@ -61,7 +52,6 @@ std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::fu
return data;
}
//! Gets all the entries in the table
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDDestructibleComponentTable.hpp
\brief Contains data for the DestructibleComponent table
*/
//! ItemComponent Struct
struct CDDestructibleComponent {
unsigned int id; //!< The component ID from the ComponentsRegistry Table
int faction; //!< The Faction ID of the object
@@ -26,35 +20,14 @@ struct CDDestructibleComponent {
int difficultyLevel; //!< ???
};
//! ItemComponent table
class CDDestructibleComponentTable : public CDTable {
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
private:
std::vector<CDDestructibleComponent> entries;
public:
//! Constructor
CDDestructibleComponentTable(void);
//! Destructor
~CDDestructibleComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDDestructibleComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDDestructibleComponent> GetEntries(void) const;
};

View File

@@ -30,11 +30,6 @@ CDEmoteTableTable::~CDEmoteTableTable(void) {
entries.clear();
}
//! Returns the table's name
std::string CDEmoteTableTable::GetName(void) const {
return "Emotes";
}
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
for (auto e : entries) {
if (e.first == id) return e.second;

View File

@@ -4,12 +4,6 @@
#include "CDTable.h"
#include <map>
/*!
\file CDEmoteTable.hpp
\brief Contains data for the CDEmoteTable table
*/
//! CDEmoteEntry Struct
struct CDEmoteTable {
CDEmoteTable() {
ID = -1;
@@ -32,25 +26,13 @@ struct CDEmoteTable {
std::string gateVersion;
};
//! CDEmoteTable table
class CDEmoteTableTable : public CDTable {
class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
private:
std::map<int, CDEmoteTable*> entries;
public:
//! Constructor
CDEmoteTableTable(void);
//! Destructor
~CDEmoteTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Returns an emote by ID
CDEmoteTableTable();
~CDEmoteTableTable();
// Returns an emote by ID
CDEmoteTable* GetEmote(int id);
};

View File

@@ -34,15 +34,6 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
tableData.finalize();
}
//! Destructor
CDFeatureGatingTable::~CDFeatureGatingTable(void) {}
//! Returns the table's name
std::string CDFeatureGatingTable::GetName(void) const {
return "FeatureGating";
}
//! Queries the table with a custom "where" clause
std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) {
std::vector<CDFeatureGating> data = cpplinq::from(this->entries)
@@ -62,7 +53,6 @@ bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const {
return false;
}
//! Gets all the entries in the table
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,11 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDFeatureGatingTable.hpp
*/
//! ItemComponent Struct
struct CDFeatureGating {
std::string featureName;
int32_t major;
@@ -16,37 +11,16 @@ struct CDFeatureGating {
std::string description;
};
//! ItemComponent table
class CDFeatureGatingTable : public CDTable {
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
private:
std::vector<CDFeatureGating> entries;
public:
//! Constructor
CDFeatureGatingTable(void);
//! Destructor
~CDFeatureGatingTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDFeatureGatingTable();
// Queries the table with a custom "where" clause
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
bool FeatureUnlocked(const std::string& feature) const;
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDFeatureGating> GetEntries(void) const;
};

View File

@@ -33,15 +33,6 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDInventoryComponentTable::~CDInventoryComponentTable(void) {}
//! Returns the table's name
std::string CDInventoryComponentTable::GetName(void) const {
return "InventoryComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) {
std::vector<CDInventoryComponent> data = cpplinq::from(this->entries)
@@ -51,7 +42,6 @@ std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function
return data;
}
//! Gets all the entries in the table
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDInventoryComponentTable.hpp
\brief Contains data for the InventoryComponent table
*/
//! ItemComponent Struct
struct CDInventoryComponent {
unsigned int id; //!< The component ID for this object
unsigned int itemid; //!< The LOT of the object
@@ -16,35 +10,14 @@ struct CDInventoryComponent {
bool equip; //!< Whether or not to equip the item
};
//! ItemComponent table
class CDInventoryComponentTable : public CDTable {
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
private:
std::vector<CDInventoryComponent> entries;
public:
//! Constructor
CDInventoryComponentTable(void);
//! Destructor
~CDInventoryComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDInventoryComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDInventoryComponent> GetEntries(void) const;
};

View File

@@ -74,14 +74,6 @@ CDItemComponentTable::CDItemComponentTable(void) {
#endif
}
//! Destructor
CDItemComponentTable::~CDItemComponentTable(void) {}
//! Returns the table's name
std::string CDItemComponentTable::GetName(void) const {
return "ItemComponent";
}
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
const auto& it = this->entries.find(skillID);
if (it != this->entries.end()) {

View File

@@ -4,12 +4,6 @@
#include "CDTable.h"
#include "dCommonVars.h"
/*!
\file CDItemComponentTable.hpp
\brief Contains data for the ItemComponent table
*/
//! ItemComponent Struct
struct CDItemComponent {
unsigned int id; //!< The Component ID
std::string equipLocation; //!< The equip location
@@ -55,28 +49,15 @@ struct CDItemComponent {
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
};
//! ItemComponent table
class CDItemComponentTable : public CDTable {
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
private:
std::map<unsigned int, CDItemComponent> entries;
public:
//! Constructor
CDItemComponentTable(void);
//! Destructor
~CDItemComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
CDItemComponentTable();
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
//! Gets an entry by ID
// Gets an entry by ID
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
static CDItemComponent Default;

View File

@@ -32,15 +32,6 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
tableData.finalize();
}
//! Destructor
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) {}
//! Returns the table's name
std::string CDItemSetSkillsTable::GetName(void) const {
return "ItemSetSkills";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) {
std::vector<CDItemSetSkills> data = cpplinq::from(this->entries)
@@ -50,7 +41,6 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDIt
return data;
}
//! Gets all the entries in the table
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
return this->entries;
}
@@ -65,4 +55,3 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(unsigned int Ski
return toReturn;
}

View File

@@ -3,50 +3,22 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDItemSetSkillsTable.hpp
\brief Contains data for the ItemSetSkills table
*/
//! ZoneTable Struct
struct CDItemSetSkills {
unsigned int SkillSetID; //!< The skill set ID
unsigned int SkillID; //!< The skill ID
unsigned int SkillCastType; //!< The skill cast type
};
//! ItemSets table
class CDItemSetSkillsTable : public CDTable {
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
private:
std::vector<CDItemSetSkills> entries;
public:
//! Constructor
CDItemSetSkillsTable(void);
//! Destructor
~CDItemSetSkillsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDItemSetSkillsTable();
// Queries the table with a custom "where" clause
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSetSkills> GetEntries(void) const;
std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID);
};

View File

@@ -44,15 +44,6 @@ CDItemSetsTable::CDItemSetsTable(void) {
tableData.finalize();
}
//! Destructor
CDItemSetsTable::~CDItemSetsTable(void) {}
//! Returns the table's name
std::string CDItemSetsTable::GetName(void) const {
return "ItemSets";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
std::vector<CDItemSets> data = cpplinq::from(this->entries)
@@ -62,7 +53,6 @@ std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> p
return data;
}
//! Gets all the entries in the table
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDItemSetsTable.hpp
\brief Contains data for the ItemSets table
*/
//! ZoneTable Struct
struct CDItemSets {
unsigned int setID; //!< The item set ID
unsigned int locStatus; //!< The loc status
@@ -27,36 +21,15 @@ struct CDItemSets {
float priority; //!< The priority
};
//! ItemSets table
class CDItemSetsTable : public CDTable {
class CDItemSetsTable : public CDTable<CDItemSetsTable> {
private:
std::vector<CDItemSets> entries;
public:
//! Constructor
CDItemSetsTable(void);
//! Destructor
~CDItemSetsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDItemSetsTable();
// Queries the table with a custom "where" clause
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSets> GetEntries(void) const;
};

View File

@@ -32,14 +32,6 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
tableData.finalize();
}
//! Destructor
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) {}
//! Returns the table's name
std::string CDLevelProgressionLookupTable::GetName(void) const {
return "LevelProgressionLookup";
}
//! Queries the table with a custom "where" clause
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {

View File

@@ -3,47 +3,21 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLevelProgressionLookupTable.hpp
\brief Contains data for the LevelProgressionLookup table
*/
//! LevelProgressionLookup Entry Struct
struct CDLevelProgressionLookup {
unsigned int id; //!< The Level ID
unsigned int requiredUScore; //!< The required LEGO Score
std::string BehaviorEffect; //!< The behavior effect attached to this
};
//! LevelProgressionLookup table
class CDLevelProgressionLookupTable : public CDTable {
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
private:
std::vector<CDLevelProgressionLookup> entries;
public:
//! Constructor
CDLevelProgressionLookupTable(void);
//! Destructor
~CDLevelProgressionLookupTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDLevelProgressionLookupTable();
// Queries the table with a custom "where" clause
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
};

View File

@@ -38,15 +38,6 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
tableData.finalize();
}
//! Destructor
CDLootMatrixTable::~CDLootMatrixTable(void) {}
//! Returns the table's name
std::string CDLootMatrixTable::GetName(void) const {
return "LootMatrix";
}
//! Queries the table with a custom "where" clause
std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatrix)> predicate) {
std::vector<CDLootMatrix> data = cpplinq::from(this->entries)
@@ -56,7 +47,6 @@ std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatr
return data;
}
//! Gets all the entries in the table
const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLootMatrixTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! LootMatrix Struct
struct CDLootMatrix {
unsigned int LootMatrixIndex; //!< The Loot Matrix Index
unsigned int LootTableIndex; //!< The Loot Table Index
@@ -21,36 +15,15 @@ struct CDLootMatrix {
UNUSED(std::string gate_version); //!< The Gate Version
};
//! MissionNPCComponent table
class CDLootMatrixTable : public CDTable {
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
private:
std::vector<CDLootMatrix> entries;
public:
//! Constructor
CDLootMatrixTable(void);
//! Destructor
~CDLootMatrixTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDLootMatrixTable();
// Queries the table with a custom "where" clause
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootMatrix>& GetEntries(void) const;
};

View File

@@ -35,14 +35,6 @@ CDLootTableTable::CDLootTableTable(void) {
tableData.finalize();
}
//! Destructor
CDLootTableTable::~CDLootTableTable(void) {}
//! Returns the table's name
std::string CDLootTableTable::GetName(void) const {
return "LootTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDLootTableTable.hpp
\brief Contains data for the LootTable table
*/
//! LootTable Struct
struct CDLootTable {
unsigned int itemid; //!< The LOT of the item
unsigned int LootTableIndex; //!< The Loot Table Index
@@ -17,36 +11,15 @@ struct CDLootTable {
unsigned int sortPriority; //!< The sorting priority
};
//! LootTable table
class CDLootTableTable : public CDTable {
class CDLootTableTable : public CDTable<CDLootTableTable> {
private:
std::vector<CDLootTable> entries;
public:
//! Constructor
CDLootTableTable(void);
//! Destructor
~CDLootTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDLootTableTable();
// Queries the table with a custom "where" clause
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootTable>& GetEntries(void) const;
};

View File

@@ -37,14 +37,6 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionEmailTable::~CDMissionEmailTable(void) {}
//! Returns the table's name
std::string CDMissionEmailTable::GetName(void) const {
return "MissionEmail";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionEmailTable.hpp
\brief Contains data for the MissionEmail table
*/
//! MissionEmail Entry Struct
struct CDMissionEmail {
unsigned int ID;
unsigned int messageType;
@@ -21,35 +15,14 @@ struct CDMissionEmail {
};
//! MissionEmail table
class CDMissionEmailTable : public CDTable {
class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
private:
std::vector<CDMissionEmail> entries;
public:
//! Constructor
CDMissionEmailTable(void);
//! Destructor
~CDMissionEmailTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDMissionEmailTable();
// Queries the table with a custom "where" clause
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMissionEmail> GetEntries(void) const;
};

View File

@@ -34,14 +34,6 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) {}
//! Returns the table's name
std::string CDMissionNPCComponentTable::GetName(void) const {
return "MissionNPCComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionNPCComponentTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! MissionNPCComponent Struct
struct CDMissionNPCComponent {
unsigned int id; //!< The ID
unsigned int missionID; //!< The Mission ID
@@ -17,35 +11,16 @@ struct CDMissionNPCComponent {
std::string gate_version; //!< The gate version
};
//! MissionNPCComponent table
class CDMissionNPCComponentTable : public CDTable {
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
private:
std::vector<CDMissionNPCComponent> entries;
public:
//! Constructor
CDMissionNPCComponentTable(void);
//! Destructor
~CDMissionNPCComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDMissionNPCComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
std::vector<CDMissionNPCComponent> GetEntries(void) const;
};

View File

@@ -42,15 +42,6 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
tableData.finalize();
}
//! Destructor
CDMissionTasksTable::~CDMissionTasksTable(void) {}
//! Returns the table's name
std::string CDMissionTasksTable::GetName(void) const {
return "MissionTasks";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) {
std::vector<CDMissionTasks> data = cpplinq::from(this->entries)
@@ -74,7 +65,6 @@ std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missio
return tasks;
}
//! Gets all the entries in the table
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMissionTasksTable.hpp
\brief Contains data for the MissionTasks table
*/
//! ObjectSkills Struct
struct CDMissionTasks {
unsigned int id; //!< The Mission ID that the task belongs to
UNUSED(unsigned int locStatus); //!< ???
@@ -25,37 +19,17 @@ struct CDMissionTasks {
UNUSED(std::string gate_version); //!< ???
};
//! ObjectSkills table
class CDMissionTasksTable : public CDTable {
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
private:
std::vector<CDMissionTasks> entries;
public:
//! Constructor
CDMissionTasksTable(void);
//! Destructor
~CDMissionTasksTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDMissionTasksTable();
// Queries the table with a custom "where" clause
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDMissionTasks>& GetEntries(void) const;
};

View File

@@ -85,15 +85,6 @@ CDMissionsTable::CDMissionsTable(void) {
Default.id = -1;
}
//! Destructor
CDMissionsTable::~CDMissionsTable(void) {}
//! Returns the table's name
std::string CDMissionsTable::GetName(void) const {
return "Missions";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) {
std::vector<CDMissions> data = cpplinq::from(this->entries)
@@ -103,7 +94,6 @@ std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> p
return data;
}
//! Gets all the entries in the table
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -5,12 +5,6 @@
#include <map>
#include <cstdint>
/*!
\file CDMissionsTable.hpp
\brief Contains data for the Missions table
*/
//! Missions Struct
struct CDMissions {
int id; //!< The Mission ID
std::string defined_type; //!< The type of mission
@@ -66,35 +60,16 @@ struct CDMissions {
int reward_bankinventory; //!< The amount of bank space this mission rewards
};
//! Missions table
class CDMissionsTable : public CDTable {
class CDMissionsTable : public CDTable<CDMissionsTable> {
private:
std::vector<CDMissions> entries;
public:
//! Constructor
CDMissionsTable(void);
//! Destructor
~CDMissionsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDMissionsTable();
// Queries the table with a custom "where" clause
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
const std::vector<CDMissions>& GetEntries(void) const;
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;

View File

@@ -37,14 +37,6 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDMovementAIComponentTable::~CDMovementAIComponentTable(void) {}
//! Returns the table's name
std::string CDMovementAIComponentTable::GetName(void) const {
return "MovementAIComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::function<bool(CDMovementAIComponent)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDMovementAIComponentTable.hpp
\brief Contains data for the MovementAIComponent table
*/
//! MovementAIComponent Struct
struct CDMovementAIComponent {
unsigned int id;
std::string MovementType;
@@ -20,36 +14,15 @@ struct CDMovementAIComponent {
std::string attachedPath;
};
//! MovementAIComponent table
class CDMovementAIComponentTable : public CDTable {
class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable> {
private:
std::vector<CDMovementAIComponent> entries;
public:
//! Constructor
CDMovementAIComponentTable(void);
//! Destructor
~CDMovementAIComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDMovementAIComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
std::vector<CDMovementAIComponent> GetEntries(void) const;
};

View File

@@ -33,14 +33,6 @@ CDObjectSkillsTable::CDObjectSkillsTable(void) {
tableData.finalize();
}
//! Destructor
CDObjectSkillsTable::~CDObjectSkillsTable(void) {}
//! Returns the table's name
std::string CDObjectSkillsTable::GetName(void) const {
return "ObjectSkills";
}
//! Queries the table with a custom "where" clause
std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) {
@@ -55,4 +47,3 @@ std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObje
std::vector<CDObjectSkills> CDObjectSkillsTable::GetEntries(void) const {
return this->entries;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDObjectSkillsTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! ObjectSkills Struct
struct CDObjectSkills {
unsigned int objectTemplate; //!< The LOT of the item
unsigned int skillID; //!< The Skill ID of the object
@@ -16,35 +10,16 @@ struct CDObjectSkills {
unsigned int AICombatWeight; //!< ???
};
//! ObjectSkills table
class CDObjectSkillsTable : public CDTable {
class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable> {
private:
std::vector<CDObjectSkills> entries;
public:
//! Constructor
CDObjectSkillsTable(void);
//! Destructor
~CDObjectSkillsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDObjectSkillsTable();
// Queries the table with a custom "where" clause
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
std::vector<CDObjectSkills> GetEntries(void) const;
};

View File

@@ -43,14 +43,6 @@ CDObjectsTable::CDObjectsTable(void) {
m_default.id = 0;
}
//! Destructor
CDObjectsTable::~CDObjectsTable(void) {}
//! Returns the table's name
std::string CDObjectsTable::GetName(void) const {
return "Objects";
}
const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
const auto& it = this->entries.find(LOT);
if (it != this->entries.end()) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDObjectsTable.hpp
\brief Contains data for the Objects table
*/
//! RebuildComponent Struct
struct CDObjects {
unsigned int id; //!< The LOT of the object
std::string name; //!< The internal name of the object
@@ -26,29 +20,14 @@ struct CDObjects {
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
};
//! ObjectSkills table
class CDObjectsTable : public CDTable {
class CDObjectsTable : public CDTable<CDObjectsTable> {
private:
//std::vector<CDObjects> entries;
std::map<unsigned int, CDObjects> entries;
CDObjects m_default;
public:
//! Constructor
CDObjectsTable(void);
//! Destructor
~CDObjectsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Gets an entry by ID
CDObjectsTable();
// Gets an entry by ID
const CDObjects& GetByID(unsigned int LOT);
};

View File

@@ -32,14 +32,6 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDPackageComponentTable::~CDPackageComponentTable(void) {}
//! Returns the table's name
std::string CDPackageComponentTable::GetName(void) const {
return "PackageComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) {

View File

@@ -3,48 +3,20 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDPackageComponentTable.hpp
\brief Contains data for the PackageComponent table
*/
//! PackageComponent Entry Struct
struct CDPackageComponent {
unsigned int id;
unsigned int LootMatrixIndex;
unsigned int packageType;
};
//! PackageComponent table
class CDPackageComponentTable : public CDTable {
class CDPackageComponentTable : public CDTable<CDPackageComponentTable> {
private:
std::vector<CDPackageComponent> entries;
public:
//! Constructor
CDPackageComponentTable(void);
//! Destructor
~CDPackageComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
// Queries the table with a custom "where" clause
std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDPackageComponent> GetEntries(void) const;
};

View File

@@ -28,7 +28,7 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
tableData.finalize();
}
CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
CDPhysicsComponentTable::~CDPhysicsComponentTable() {
for (auto e : m_entries) {
if (e.second) delete e.second;
}
@@ -36,10 +36,6 @@ CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
m_entries.clear();
}
std::string CDPhysicsComponentTable::GetName(void) const {
return "PhysicsComponent";
}
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
for (auto e : m_entries) {
if (e.first == componentID) return e.second;

View File

@@ -21,12 +21,12 @@ struct CDPhysicsComponent {
UNUSED(std::string gravityVolumeAsset);
};
class CDPhysicsComponentTable : public CDTable {
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {
public:
CDPhysicsComponentTable(void);
~CDPhysicsComponentTable(void);
CDPhysicsComponentTable();
~CDPhysicsComponentTable();
std::string GetName(void) const override;
static const std::string GetTableName() { return "PhysicsComponent"; };
CDPhysicsComponent* GetByID(unsigned int componentID);
private:

View File

@@ -32,12 +32,6 @@ CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
tableData.finalize();
}
CDPropertyEntranceComponentTable::~CDPropertyEntranceComponentTable(void) = default;
std::string CDPropertyEntranceComponentTable::GetName() const {
return "PropertyEntranceComponent";
}
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
for (const auto& entry : entries) {
if (entry.id == id)

View File

@@ -9,31 +9,13 @@ struct CDPropertyEntranceComponent {
std::string groupType;
};
class CDPropertyEntranceComponentTable : public CDTable {
class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable> {
public:
//! Constructor
CDPropertyEntranceComponentTable();
//! Destructor
~CDPropertyEntranceComponentTable();
//! Returns the table's name
/*!
\return The table name
*/
[[nodiscard]] std::string GetName() const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
// Queries the table with a custom "where" clause
CDPropertyEntranceComponent GetByID(uint32_t id);
//! Gets all the entries in the table
/*!
\return The entries
*/
// Gets all the entries in the table
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
private:
std::vector<CDPropertyEntranceComponent> entries{};

View File

@@ -30,12 +30,6 @@ CDPropertyTemplateTable::CDPropertyTemplateTable() {
tableData.finalize();
}
CDPropertyTemplateTable::~CDPropertyTemplateTable() = default;
std::string CDPropertyTemplateTable::GetName() const {
return "PropertyTemplate";
}
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
for (const auto& entry : entries) {
if (entry.mapID == mapID)

View File

@@ -8,12 +8,11 @@ struct CDPropertyTemplate {
std::string spawnName;
};
class CDPropertyTemplateTable : public CDTable {
class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable> {
public:
CDPropertyTemplateTable();
~CDPropertyTemplateTable();
[[nodiscard]] std::string GetName() const override;
static const std::string GetTableName() { return "PropertyTemplate"; };
CDPropertyTemplate GetByMapID(uint32_t mapID);
private:
std::vector<CDPropertyTemplate> entries{};

View File

@@ -33,14 +33,6 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDProximityMonitorComponentTable::~CDProximityMonitorComponentTable(void) {}
//! Returns the table's name
std::string CDProximityMonitorComponentTable::GetName(void) const {
return "ProximityMonitorComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query(std::function<bool(CDProximityMonitorComponent)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDProximityMonitorComponentTable.hpp
\brief Contains data for the ProximityMonitorComponent table
*/
//! ProximityMonitorComponent Entry Struct
struct CDProximityMonitorComponent {
unsigned int id;
std::string Proximities;
@@ -16,36 +10,14 @@ struct CDProximityMonitorComponent {
bool LoadOnServer;
};
//! ProximityMonitorComponent table
class CDProximityMonitorComponentTable : public CDTable {
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable> {
private:
std::vector<CDProximityMonitorComponent> entries;
public:
//! Constructor
CDProximityMonitorComponentTable(void);
//! Destructor
~CDProximityMonitorComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDProximityMonitorComponent> GetEntries(void) const;
};

View File

@@ -43,12 +43,6 @@ CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
tableData.finalize();
}
CDRailActivatorComponentTable::~CDRailActivatorComponentTable() = default;
std::string CDRailActivatorComponentTable::GetName() const {
return "RailActivatorComponent";
}
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
for (const auto& entry : m_Entries) {
if (entry.id == id)

View File

@@ -20,12 +20,10 @@ struct CDRailActivatorComponent {
bool showNameBillboard;
};
class CDRailActivatorComponentTable : public CDTable {
class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable> {
public:
CDRailActivatorComponentTable();
~CDRailActivatorComponentTable();
std::string GetName() const override;
static const std::string GetTableName() { return "RailActivatorComponent"; };
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
private:

View File

@@ -33,14 +33,6 @@ CDRarityTableTable::CDRarityTableTable(void) {
tableData.finalize();
}
//! Destructor
CDRarityTableTable::~CDRarityTableTable(void) {}
//! Returns the table's name
std::string CDRarityTableTable::GetName(void) const {
return "RarityTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarityTable)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDRarityTableTable.hpp
\brief Contains data for the RarityTable table
*/
//! RarityTable Entry Struct
struct CDRarityTable {
unsigned int id;
float randmax;
@@ -32,37 +26,15 @@ struct CDRarityTable {
}
};
//! RarityTable table
class CDRarityTableTable : public CDTable {
class CDRarityTableTable : public CDTable<CDRarityTableTable> {
private:
std::vector<CDRarityTable> entries;
public:
//! Constructor
CDRarityTableTable(void);
//! Destructor
~CDRarityTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDRarityTableTable();
// Queries the table with a custom "where" clause
std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDRarityTable>& GetEntries(void) const;
const std::vector<CDRarityTable>& GetEntries() const;
};

View File

@@ -39,14 +39,6 @@ CDRebuildComponentTable::CDRebuildComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDRebuildComponentTable::~CDRebuildComponentTable(void) {}
//! Returns the table's name
std::string CDRebuildComponentTable::GetName(void) const {
return "RebuildComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDRebuildComponentTable.hpp
\brief Contains data for the RebuildComponent table
*/
//! RebuildComponent Struct
struct CDRebuildComponent {
unsigned int id; //!< The component Id
float reset_time; //!< The reset time
@@ -22,36 +16,15 @@ struct CDRebuildComponent {
float time_before_smash; //!< The time before smash
};
//! ObjectSkills table
class CDRebuildComponentTable : public CDTable {
class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable> {
private:
std::vector<CDRebuildComponent> entries;
public:
//! Constructor
CDRebuildComponentTable(void);
//! Destructor
~CDRebuildComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDRebuildComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDRebuildComponent> GetEntries(void) const;
std::vector<CDRebuildComponent> GetEntries() const;
};

View File

@@ -26,10 +26,6 @@ CDRewardsTable::~CDRewardsTable(void) {
m_entries.clear();
}
std::string CDRewardsTable::GetName(void) const {
return "Rewards";
}
std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) {
std::vector<CDRewards*> result{};
for (const auto& e : m_entries) {

View File

@@ -11,12 +11,12 @@ struct CDRewards {
int32_t count;
};
class CDRewardsTable : public CDTable {
class CDRewardsTable : public CDTable<CDRewardsTable> {
public:
CDRewardsTable(void);
~CDRewardsTable(void);
CDRewardsTable();
~CDRewardsTable();
std::string GetName(void) const override;
static const std::string GetTableName() { return "Rewards"; };
std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
private:

View File

@@ -29,14 +29,6 @@ CDScriptComponentTable::CDScriptComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDScriptComponentTable::~CDScriptComponentTable(void) {}
//! Returns the table's name
std::string CDScriptComponentTable::GetName(void) const {
return "ScriptComponent";
}
const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
std::map<unsigned int, CDScriptComponent>::iterator it = this->entries.find(id);
if (it != this->entries.end()) {

View File

@@ -3,44 +3,20 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDScriptComponentTable.hpp
\brief Contains data for the ScriptComponent table
*/
//! ScriptComponent Struct
struct CDScriptComponent {
unsigned int id; //!< The component ID
std::string script_name; //!< The script name
std::string client_script_name; //!< The client script name
};
//! ObjectSkills table
class CDScriptComponentTable : public CDTable {
class CDScriptComponentTable : public CDTable<CDScriptComponentTable> {
private:
std::map<unsigned int, CDScriptComponent> entries;
CDScriptComponent m_ToReturnWhenNoneFound;
public:
//! Gets an entry by ID
CDScriptComponentTable();
// Gets an entry by scriptID
const CDScriptComponent& GetByID(unsigned int id);
//! Constructor
CDScriptComponentTable(void);
//! Destructor
~CDScriptComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
};

View File

@@ -51,24 +51,8 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
tableData.finalize();
}
//! Destructor
CDSkillBehaviorTable::~CDSkillBehaviorTable(void) {}
//! Returns the table's name
std::string CDSkillBehaviorTable::GetName(void) const {
return "SkillBehavior";
}
//! Queries the table with a custom "where" clause
std::vector<CDSkillBehavior> CDSkillBehaviorTable::Query(std::function<bool(CDSkillBehavior)> predicate) {
/*std::vector<CDSkillBehavior> data = cpplinq::from(this->entries)
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;*/
//Logger::LogDebug("CDSkillBehaviorTable", "The 'Query' function is no longer working! Please use GetSkillByID instead!");
std::vector<CDSkillBehavior> data; //So MSVC shuts up
return data;
}

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDSkillBehaviorTable.hpp
\brief Contains data for the SkillBehavior table
*/
//! ZoneTable Struct
struct CDSkillBehavior {
unsigned int skillID; //!< The Skill ID of the skill
UNUSED(unsigned int locStatus); //!< ??
@@ -31,33 +25,17 @@ struct CDSkillBehavior {
UNUSED(unsigned int cancelType); //!< The cancel type (?)
};
//! SkillBehavior table
class CDSkillBehaviorTable : public CDTable {
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
private:
std::map<unsigned int, CDSkillBehavior> entries;
CDSkillBehavior m_empty;
public:
//! Constructor
CDSkillBehaviorTable(void);
//! Destructor
~CDSkillBehaviorTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDSkillBehaviorTable();
// Queries the table with a custom "where" clause
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
//! Gets an entry by ID
// Gets an entry by skillID
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
};

View File

@@ -1,9 +1,8 @@
#pragma once
// Custom Classes
#include "../CDClientDatabase.h"
#include "CDClientDatabase.h"
#include "Singleton.h"
// C++
#include <functional>
#include <string>
#include <vector>
@@ -19,23 +18,8 @@
#pragma warning (disable : 4244) //Disable double to float conversion warnings
#pragma warning (disable : 4715) //Disable "not all control paths return a value"
#if defined(__unix) || defined(__APPLE__)
//For Linux:
typedef __int64_t __int64;
#endif
/*!
\file CDTable.hpp
\brief A virtual class for CDClient Tables
*/
//! The base class for all CD tables
class CDTable {
public:
//! Returns the table's name
/*!
\return The table name
*/
virtual std::string GetName() const = 0;
template<class Table>
class CDTable : public Singleton<Table> {
protected:
virtual ~CDTable() = default;
};

View File

@@ -34,14 +34,6 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
tableData.finalize();
}
//! Destructor
CDVendorComponentTable::~CDVendorComponentTable(void) {}
//! Returns the table's name
std::string CDVendorComponentTable::GetName(void) const {
return "VendorComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) {

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDVendorComponentTable.hpp
\brief Contains data for the VendorComponent table
*/
//! VendorComponent Struct
struct CDVendorComponent {
unsigned int id; //!< The Component ID
float buyScalar; //!< Buy Scalar (what does that mean?)
@@ -17,36 +11,15 @@ struct CDVendorComponent {
unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
};
//! VendorComponent table
class CDVendorComponentTable : public CDTable {
class CDVendorComponentTable : public CDTable<CDVendorComponentTable> {
private:
std::vector<CDVendorComponent> entries;
public:
//! Constructor
CDVendorComponentTable(void);
//! Destructor
~CDVendorComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDVendorComponentTable();
// Queries the table with a custom "where" clause
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDVendorComponent> GetEntries(void) const;
};

View File

@@ -53,14 +53,6 @@ CDZoneTableTable::CDZoneTableTable(void) {
tableData.finalize();
}
//! Destructor
CDZoneTableTable::~CDZoneTableTable(void) {}
//! Returns the table's name
std::string CDZoneTableTable::GetName(void) const {
return "ZoneTable";
}
//! Queries the table with a zoneID to find.
const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
const auto& iter = m_Entries.find(zoneID);

View File

@@ -3,12 +3,6 @@
// Custom Classes
#include "CDTable.h"
/*!
\file CDZoneTableTable.hpp
\brief Contains data for the ZoneTable table
*/
//! ZoneTable Struct
struct CDZoneTable {
unsigned int zoneID; //!< The Zone ID of the object
unsigned int locStatus; //!< The Locale Status(?)
@@ -39,28 +33,13 @@ struct CDZoneTable {
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
};
//! ZoneTable table
class CDZoneTableTable : public CDTable {
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
private:
std::map<unsigned int, CDZoneTable> m_Entries;
public:
CDZoneTableTable();
//! Constructor
CDZoneTableTable(void);
//! Destructor
~CDZoneTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a zoneID to find.
/*!
\param id The zoneID
*/
// Queries the table with a zoneID to find.
const CDZoneTable* Query(unsigned int zoneID);
};