mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
format codebase
This commit is contained in:
@@ -2,19 +2,19 @@
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
|
||||
// Static Variables
|
||||
static CppSQLite3DB * conn = new CppSQLite3DB();
|
||||
static CppSQLite3DB* conn = new CppSQLite3DB();
|
||||
|
||||
//! Opens a connection with the CDClient
|
||||
void CDClientDatabase::Connect(const std::string& filename) {
|
||||
conn->open(filename.c_str());
|
||||
conn->open(filename.c_str());
|
||||
}
|
||||
|
||||
//! Queries the CDClient
|
||||
CppSQLite3Query CDClientDatabase::ExecuteQuery(const std::string& query) {
|
||||
return conn->execQuery(query.c_str());
|
||||
return conn->execQuery(query.c_str());
|
||||
}
|
||||
|
||||
//! Makes prepared statements
|
||||
CppSQLite3Statement CDClientDatabase::CreatePreppedStmt(const std::string& query) {
|
||||
return conn->compileStatement(query.c_str());
|
||||
return conn->compileStatement(query.c_str());
|
||||
}
|
||||
|
@@ -13,10 +13,10 @@
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
|
||||
// Enable this to cache all entries in each table for fast access, comes with more memory cost
|
||||
//#define CDCLIENT_CACHE_ALL
|
||||
// Enable this to cache all entries in each table for fast access, comes with more memory cost
|
||||
//#define CDCLIENT_CACHE_ALL
|
||||
|
||||
// Enable this to skip some unused columns in some tables
|
||||
// Enable this to skip some unused columns in some tables
|
||||
#define UNUSED(v)
|
||||
|
||||
/*!
|
||||
@@ -24,26 +24,26 @@
|
||||
\brief An interface between the CDClient.sqlite file and the server
|
||||
*/
|
||||
|
||||
//! The CDClient Database namespace
|
||||
//! The CDClient Database namespace
|
||||
namespace CDClientDatabase {
|
||||
|
||||
//! 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);
|
||||
|
||||
//! Queries the CDClient and parses arguments
|
||||
/*!
|
||||
\param query The query with formatted arguments
|
||||
\return prepared SQLite Statement
|
||||
*/
|
||||
CppSQLite3Statement CreatePreppedStmt(const std::string& query);
|
||||
|
||||
//! 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);
|
||||
|
||||
//! Queries the CDClient and parses arguments
|
||||
/*!
|
||||
\param query The query with formatted arguments
|
||||
\return prepared SQLite Statement
|
||||
*/
|
||||
CppSQLite3Statement CreatePreppedStmt(const std::string& query);
|
||||
};
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "CDClientManager.h"
|
||||
|
||||
// Static Variables
|
||||
CDClientManager * CDClientManager::m_Address = nullptr;
|
||||
CDClientManager* CDClientManager::m_Address = nullptr;
|
||||
|
||||
//! Initializes the manager
|
||||
void CDClientManager::Initialize(void) {
|
||||
|
@@ -52,45 +52,45 @@
|
||||
\brief A manager for the CDClient tables
|
||||
*/
|
||||
|
||||
//! Manages all data from the CDClient
|
||||
//! Manages all data from the CDClient
|
||||
class CDClientManager {
|
||||
private:
|
||||
static CDClientManager * m_Address; //!< The singleton address
|
||||
|
||||
std::unordered_map<std::string, CDTable*> tables; //!< The tables
|
||||
|
||||
static CDClientManager* m_Address; //!< The singleton address
|
||||
|
||||
std::unordered_map<std::string, CDTable*> tables; //!< The tables
|
||||
|
||||
public:
|
||||
|
||||
//! The singleton method
|
||||
static CDClientManager * Instance() {
|
||||
if (m_Address == 0) {
|
||||
m_Address = new CDClientManager;
|
||||
}
|
||||
|
||||
return m_Address;
|
||||
}
|
||||
|
||||
//! Initializes the manager
|
||||
void Initialize(void);
|
||||
|
||||
//! Fetches a CDClient table
|
||||
/*!
|
||||
This function uses typename T which must be a subclass of CDTable.
|
||||
It returns the class that conforms to the class name
|
||||
|
||||
\param tableName The table name
|
||||
\return The class or nullptr
|
||||
*/
|
||||
template<typename T>
|
||||
T * GetTable(const std::string& tableName) {
|
||||
static_assert(std::is_base_of<CDTable, T>::value, "T should inherit from CDTable!");
|
||||
|
||||
for (auto itr = this->tables.begin(); itr != this->tables.end(); ++itr) {
|
||||
if (itr->first == tableName) {
|
||||
return dynamic_cast<T*>(itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//! The singleton method
|
||||
static CDClientManager* Instance() {
|
||||
if (m_Address == 0) {
|
||||
m_Address = new CDClientManager;
|
||||
}
|
||||
|
||||
return m_Address;
|
||||
}
|
||||
|
||||
//! Initializes the manager
|
||||
void Initialize(void);
|
||||
|
||||
//! Fetches a CDClient table
|
||||
/*!
|
||||
This function uses typename T which must be a subclass of CDTable.
|
||||
It returns the class that conforms to the class name
|
||||
|
||||
\param tableName The table name
|
||||
\return The class or nullptr
|
||||
*/
|
||||
template<typename T>
|
||||
T* GetTable(const std::string& tableName) {
|
||||
static_assert(std::is_base_of<CDTable, T>::value, "T should inherit from CDTable!");
|
||||
|
||||
for (auto itr = this->tables.begin(); itr != this->tables.end(); ++itr) {
|
||||
if (itr->first == tableName) {
|
||||
return dynamic_cast<T*>(itr->second);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
@@ -6,8 +6,8 @@ using namespace std;
|
||||
|
||||
#pragma warning (disable:4251) //Disables SQL warnings
|
||||
|
||||
sql::Driver * Database::driver;
|
||||
sql::Connection * Database::con;
|
||||
sql::Driver* Database::driver;
|
||||
sql::Connection* Database::con;
|
||||
sql::Properties Database::props;
|
||||
std::string Database::database;
|
||||
|
||||
@@ -66,8 +66,7 @@ sql::PreparedStatement* Database::CreatePreppedStmt(const std::string& query) {
|
||||
Game::logger->Log("Database", "Trying to reconnect to MySQL");
|
||||
}
|
||||
|
||||
if (!con->isValid() || con->isClosed())
|
||||
{
|
||||
if (!con->isValid() || con->isClosed()) {
|
||||
delete con;
|
||||
|
||||
con = nullptr;
|
||||
@@ -83,4 +82,4 @@ sql::PreparedStatement* Database::CreatePreppedStmt(const std::string& query) {
|
||||
|
||||
void Database::Commit() {
|
||||
Database::con->commit();
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@ public:
|
||||
|
||||
class Database {
|
||||
private:
|
||||
static sql::Driver *driver;
|
||||
static sql::Connection *con;
|
||||
static sql::Driver* driver;
|
||||
static sql::Connection* con;
|
||||
static sql::Properties props;
|
||||
static std::string database;
|
||||
public:
|
||||
|
@@ -9,70 +9,69 @@
|
||||
void MigrationRunner::RunMigrations() {
|
||||
auto stmt = Database::CreatePreppedStmt("CREATE TABLE IF NOT EXISTS migration_history (name TEXT NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP());");
|
||||
stmt->executeQuery();
|
||||
delete stmt;
|
||||
delete stmt;
|
||||
|
||||
sql::SQLString finalSQL = "";
|
||||
Migration checkMigration{};
|
||||
sql::SQLString finalSQL = "";
|
||||
Migration checkMigration{};
|
||||
|
||||
for (const auto& entry : GeneralUtils::GetFileNamesFromFolder("./migrations/")) {
|
||||
auto migration = LoadMigration(entry);
|
||||
for (const auto& entry : GeneralUtils::GetFileNamesFromFolder("./migrations/")) {
|
||||
auto migration = LoadMigration(entry);
|
||||
|
||||
if (migration.data.empty()) {
|
||||
continue;
|
||||
}
|
||||
if (migration.data.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
checkMigration = migration;
|
||||
checkMigration = migration;
|
||||
|
||||
stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
|
||||
stmt->setString(1, migration.name);
|
||||
auto res = stmt->executeQuery();
|
||||
bool doExit = res->next();
|
||||
delete res;
|
||||
delete stmt;
|
||||
if (doExit) continue;
|
||||
stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
|
||||
stmt->setString(1, migration.name);
|
||||
auto res = stmt->executeQuery();
|
||||
bool doExit = res->next();
|
||||
delete res;
|
||||
delete stmt;
|
||||
if (doExit) continue;
|
||||
|
||||
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
|
||||
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
|
||||
|
||||
finalSQL.append(migration.data);
|
||||
finalSQL.append('\n');
|
||||
finalSQL.append(migration.data);
|
||||
finalSQL.append('\n');
|
||||
|
||||
stmt = Database::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
stmt->setString(1, entry);
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
}
|
||||
stmt = Database::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
stmt->setString(1, entry);
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
}
|
||||
|
||||
if (!finalSQL.empty()) {
|
||||
try {
|
||||
auto simpleStatement = Database::CreateStmt();
|
||||
simpleStatement->execute(finalSQL);
|
||||
delete simpleStatement;
|
||||
}
|
||||
catch (sql::SQLException e) {
|
||||
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
|
||||
}
|
||||
}
|
||||
if (!finalSQL.empty()) {
|
||||
try {
|
||||
auto simpleStatement = Database::CreateStmt();
|
||||
simpleStatement->execute(finalSQL);
|
||||
delete simpleStatement;
|
||||
} catch (sql::SQLException e) {
|
||||
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Migration MigrationRunner::LoadMigration(std::string path) {
|
||||
Migration migration{};
|
||||
std::ifstream file("./migrations/" + path);
|
||||
Migration migration{};
|
||||
std::ifstream file("./migrations/" + path);
|
||||
|
||||
if (file.is_open()) {
|
||||
std::hash<std::string> hash;
|
||||
if (file.is_open()) {
|
||||
std::hash<std::string> hash;
|
||||
|
||||
std::string line;
|
||||
std::string total = "";
|
||||
std::string line;
|
||||
std::string total = "";
|
||||
|
||||
while (std::getline(file, line)) {
|
||||
total += line;
|
||||
}
|
||||
while (std::getline(file, line)) {
|
||||
total += line;
|
||||
}
|
||||
|
||||
file.close();
|
||||
file.close();
|
||||
|
||||
migration.name = path;
|
||||
migration.data = total;
|
||||
}
|
||||
migration.name = path;
|
||||
migration.data = total;
|
||||
}
|
||||
|
||||
return migration;
|
||||
return migration;
|
||||
}
|
||||
|
@@ -16,4 +16,4 @@ class MigrationRunner {
|
||||
public:
|
||||
static void RunMigrations();
|
||||
static Migration LoadMigration(std::string path);
|
||||
};
|
||||
};
|
||||
|
@@ -49,7 +49,7 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDActivitiesTable::~CDActivitiesTable(void) { }
|
||||
CDActivitiesTable::~CDActivitiesTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDActivitiesTable::GetName(void) const {
|
||||
|
@@ -2,59 +2,59 @@
|
||||
|
||||
//! Constructor
|
||||
CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ActivityRewards");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
|
||||
while (!tableData.eof()) {
|
||||
CDActivityRewards entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.ActivityRewardIndex = tableData.getIntField(1, -1);
|
||||
entry.activityRating = tableData.getIntField(2, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(3, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(4, -1);
|
||||
entry.ChallengeRating = tableData.getIntField(5, -1);
|
||||
entry.description = tableData.getStringField(6, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
|
||||
while (!tableData.eof()) {
|
||||
CDActivityRewards entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.ActivityRewardIndex = tableData.getIntField(1, -1);
|
||||
entry.activityRating = tableData.getIntField(2, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(3, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(4, -1);
|
||||
entry.ChallengeRating = tableData.getIntField(5, -1);
|
||||
entry.description = tableData.getStringField(6, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDActivityRewardsTable::~CDActivityRewardsTable(void) { }
|
||||
CDActivityRewardsTable::~CDActivityRewardsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDActivityRewardsTable::GetName(void) const {
|
||||
return "ActivityRewards";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,47 +8,47 @@
|
||||
\brief Contains data for the ActivityRewards table
|
||||
*/
|
||||
|
||||
//! ActivityRewards Entry Struct
|
||||
//! ActivityRewards Entry Struct
|
||||
struct CDActivityRewards {
|
||||
unsigned int objectTemplate; //!< The object template (?)
|
||||
unsigned int ActivityRewardIndex; //!< The activity reward index
|
||||
int activityRating; //!< The activity rating
|
||||
unsigned int LootMatrixIndex; //!< The loot matrix index
|
||||
unsigned int CurrencyIndex; //!< The currency index
|
||||
unsigned int ChallengeRating; //!< The challenge rating
|
||||
std::string description; //!< The description
|
||||
unsigned int objectTemplate; //!< The object template (?)
|
||||
unsigned int ActivityRewardIndex; //!< The activity reward index
|
||||
int activityRating; //!< The activity rating
|
||||
unsigned int LootMatrixIndex; //!< The loot matrix index
|
||||
unsigned int CurrencyIndex; //!< The currency index
|
||||
unsigned int ChallengeRating; //!< The challenge rating
|
||||
std::string description; //!< The description
|
||||
};
|
||||
|
||||
|
||||
//! ActivityRewards table
|
||||
class CDActivityRewardsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDActivityRewards> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
@@ -2,65 +2,65 @@
|
||||
|
||||
//! Constructor
|
||||
CDAnimationsTable::CDAnimationsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
|
||||
while (!tableData.eof()) {
|
||||
CDAnimations entry;
|
||||
entry.animationGroupID = tableData.getIntField(0, -1);
|
||||
entry.animation_type = tableData.getStringField(1, "");
|
||||
entry.animation_name = tableData.getStringField(2, "");
|
||||
entry.chance_to_play = tableData.getFloatField(3, -1.0f);
|
||||
entry.min_loops = tableData.getIntField(4, -1);
|
||||
entry.max_loops = tableData.getIntField(5, -1);
|
||||
entry.animation_length = tableData.getFloatField(6, -1.0f);
|
||||
entry.hideEquip = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.ignoreUpperBody = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.restartable = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.face_animation_name = tableData.getStringField(10, "");
|
||||
entry.priority = tableData.getFloatField(11, -1.0f);
|
||||
entry.blendTime = tableData.getFloatField(12, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
|
||||
while (!tableData.eof()) {
|
||||
CDAnimations entry;
|
||||
entry.animationGroupID = tableData.getIntField(0, -1);
|
||||
entry.animation_type = tableData.getStringField(1, "");
|
||||
entry.animation_name = tableData.getStringField(2, "");
|
||||
entry.chance_to_play = tableData.getFloatField(3, -1.0f);
|
||||
entry.min_loops = tableData.getIntField(4, -1);
|
||||
entry.max_loops = tableData.getIntField(5, -1);
|
||||
entry.animation_length = tableData.getFloatField(6, -1.0f);
|
||||
entry.hideEquip = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.ignoreUpperBody = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.restartable = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.face_animation_name = tableData.getStringField(10, "");
|
||||
entry.priority = tableData.getFloatField(11, -1.0f);
|
||||
entry.blendTime = tableData.getFloatField(12, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDAnimationsTable::~CDAnimationsTable(void) { }
|
||||
CDAnimationsTable::~CDAnimationsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDAnimationsTable::GetName(void) const {
|
||||
return "Animations";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDAnimations> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,53 +8,53 @@
|
||||
\brief Contains data for the Animations table
|
||||
*/
|
||||
|
||||
//! Animations Entry Struct
|
||||
//! Animations Entry Struct
|
||||
struct CDAnimations {
|
||||
unsigned int animationGroupID; //!< The animation group ID
|
||||
std::string animation_type; //!< The animation type
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
unsigned int min_loops; //!< The minimum number of loops
|
||||
unsigned int max_loops; //!< The maximum number of loops
|
||||
float animation_length; //!< The animation length
|
||||
bool hideEquip; //!< Whether or not to hide the equip
|
||||
bool ignoreUpperBody; //!< Whether or not to ignore the upper body
|
||||
bool restartable; //!< Whether or not the animation is restartable
|
||||
std::string face_animation_name; //!< The face animation name
|
||||
float priority; //!< The priority
|
||||
float blendTime; //!< The blend time
|
||||
unsigned int animationGroupID; //!< The animation group ID
|
||||
std::string animation_type; //!< The animation type
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
unsigned int min_loops; //!< The minimum number of loops
|
||||
unsigned int max_loops; //!< The maximum number of loops
|
||||
float animation_length; //!< The animation length
|
||||
bool hideEquip; //!< Whether or not to hide the equip
|
||||
bool ignoreUpperBody; //!< Whether or not to ignore the upper body
|
||||
bool restartable; //!< Whether or not the animation is restartable
|
||||
std::string face_animation_name; //!< The face animation name
|
||||
float priority; //!< The priority
|
||||
float blendTime; //!< The blend time
|
||||
};
|
||||
|
||||
|
||||
//! Animations table
|
||||
class CDAnimationsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDAnimations> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
@@ -31,15 +31,14 @@ CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) { }
|
||||
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorParameterTable::GetName(void) const {
|
||||
return "BehaviorParameter";
|
||||
}
|
||||
|
||||
CDBehaviorParameter CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue)
|
||||
{
|
||||
CDBehaviorParameter CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
|
||||
CDBehaviorParameter returnValue;
|
||||
returnValue.behaviorID = 0;
|
||||
returnValue.parameterID = m_ParametersList.end();
|
||||
|
@@ -10,11 +10,11 @@
|
||||
\brief Contains data for the BehaviorParameter table
|
||||
*/
|
||||
|
||||
//! BehaviorParameter Entry Struct
|
||||
//! BehaviorParameter Entry Struct
|
||||
struct CDBehaviorParameter {
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
std::unordered_set<std::string>::iterator parameterID; //!< The Parameter ID
|
||||
float value; //!< The value of the behavior template
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
std::unordered_set<std::string>::iterator parameterID; //!< The Parameter ID
|
||||
float value; //!< The value of the behavior template
|
||||
};
|
||||
|
||||
//! BehaviorParameter table
|
||||
@@ -23,19 +23,19 @@ private:
|
||||
std::unordered_map<size_t, CDBehaviorParameter> m_Entries;
|
||||
std::unordered_set<std::string> m_ParametersList;
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorParameterTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBehaviorParameterTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorParameterTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBehaviorParameterTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
CDBehaviorParameter GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
||||
|
||||
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
|
||||
|
@@ -2,76 +2,76 @@
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BehaviorTemplate");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorTemplate entry;
|
||||
entry.behaviorID = tableData.getIntField(0, -1);
|
||||
entry.templateID = tableData.getIntField(1, -1);
|
||||
entry.effectID = tableData.getIntField(2, -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;
|
||||
}
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BehaviorTemplate");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorTemplate entry;
|
||||
entry.behaviorID = tableData.getIntField(0, -1);
|
||||
entry.templateID = tableData.getIntField(1, -1);
|
||||
entry.effectID = tableData.getIntField(2, -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;
|
||||
}
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) { }
|
||||
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorTemplateTable::GetName(void) const {
|
||||
return "BehaviorTemplate";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
const CDBehaviorTemplate CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) {
|
||||
auto entry = this->entriesMappedByBehaviorID.find(behaviorID);
|
||||
if (entry == this->entriesMappedByBehaviorID.end()) {
|
||||
CDBehaviorTemplate entryToReturn;
|
||||
entryToReturn.behaviorID = 0;
|
||||
entryToReturn.effectHandle = m_EffectHandles.end();
|
||||
entryToReturn.effectID = 0;
|
||||
return entryToReturn;
|
||||
} else {
|
||||
return entry->second;
|
||||
}
|
||||
auto entry = this->entriesMappedByBehaviorID.find(behaviorID);
|
||||
if (entry == this->entriesMappedByBehaviorID.end()) {
|
||||
CDBehaviorTemplate entryToReturn;
|
||||
entryToReturn.behaviorID = 0;
|
||||
entryToReturn.effectHandle = m_EffectHandles.end();
|
||||
entryToReturn.effectID = 0;
|
||||
return entryToReturn;
|
||||
} else {
|
||||
return entry->second;
|
||||
}
|
||||
}
|
||||
|
@@ -10,46 +10,46 @@
|
||||
\brief Contains data for the BehaviorTemplate table
|
||||
*/
|
||||
|
||||
//! BehaviorTemplate Entry Struct
|
||||
//! BehaviorTemplate Entry Struct
|
||||
struct CDBehaviorTemplate {
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
unsigned int templateID; //!< The Template ID (LOT)
|
||||
unsigned int effectID; //!< The Effect ID attached
|
||||
std::unordered_set<std::string>::iterator effectHandle; //!< The effect handle
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
unsigned int templateID; //!< The Template ID (LOT)
|
||||
unsigned int effectID; //!< The Effect ID attached
|
||||
std::unordered_set<std::string>::iterator effectHandle; //!< The effect handle
|
||||
};
|
||||
|
||||
|
||||
//! BehaviorTemplate table
|
||||
class CDBehaviorTemplateTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDBehaviorTemplate> entries;
|
||||
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
|
||||
std::unordered_set<std::string> m_EffectHandles;
|
||||
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
|
||||
*/
|
||||
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);
|
||||
//! 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
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
@@ -11,9 +11,9 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
@@ -32,7 +32,7 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBrickIDTableTable::~CDBrickIDTableTable(void) { }
|
||||
CDBrickIDTableTable::~CDBrickIDTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBrickIDTableTable::GetName(void) const {
|
||||
|
@@ -4,33 +4,33 @@
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t) entry.component_type) << 32 | ((uint64_t) entry.id), entry.component_id);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
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:
|
||||
@@ -48,27 +48,25 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
|
||||
}
|
||||
*/
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) { }
|
||||
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDComponentsRegistryTable::GetName(void) const {
|
||||
return "ComponentsRegistry";
|
||||
return "ComponentsRegistry";
|
||||
}
|
||||
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue)
|
||||
{
|
||||
const auto& iter = this->mappedEntries.find(((uint64_t) componentType) << 32 | ((uint64_t) id));
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue) {
|
||||
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
|
||||
if (iter == this->mappedEntries.end())
|
||||
{
|
||||
if (iter == this->mappedEntries.end()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@@ -85,19 +83,19 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componen
|
||||
*/
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
// Now get the data
|
||||
// Now get the data
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM ComponentsRegistry WHERE id = " << std::to_string(id);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
|
||||
//Darwin's stuff:
|
||||
const auto& it = this->mappedEntries.find(entry.id);
|
||||
@@ -106,15 +104,14 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componen
|
||||
if (iter == it->second.end()) {
|
||||
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} 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();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
|
@@ -8,33 +8,33 @@
|
||||
\brief Contains data for the ComponentsRegistry table
|
||||
*/
|
||||
|
||||
//! ComponentsRegistry Entry Struct
|
||||
//! ComponentsRegistry Entry Struct
|
||||
struct CDComponentsRegistry {
|
||||
unsigned int id; //!< The LOT is used as the ID
|
||||
unsigned int component_type; //!< See ComponentTypes enum for values
|
||||
unsigned int 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
|
||||
unsigned int id; //!< The LOT is used as the ID
|
||||
unsigned int component_type; //!< See ComponentTypes enum for values
|
||||
unsigned int 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
|
||||
};
|
||||
|
||||
|
||||
//! ComponentsRegistry table
|
||||
class CDComponentsRegistryTable : public CDTable {
|
||||
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;
|
||||
//std::vector<CDComponentsRegistry> entries;
|
||||
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
int32_t GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue = 0);
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDComponentsRegistryTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
int32_t GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue = 0);
|
||||
};
|
||||
|
@@ -2,57 +2,57 @@
|
||||
|
||||
//! Constructor
|
||||
CDCurrencyTableTable::CDCurrencyTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM CurrencyTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM CurrencyTable");
|
||||
while (!tableData.eof()) {
|
||||
CDCurrencyTable entry;
|
||||
entry.currencyIndex = tableData.getIntField(0, -1);
|
||||
entry.npcminlevel = tableData.getIntField(1, -1);
|
||||
entry.minvalue = tableData.getIntField(2, -1);
|
||||
entry.maxvalue = tableData.getIntField(3, -1);
|
||||
entry.id = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM CurrencyTable");
|
||||
while (!tableData.eof()) {
|
||||
CDCurrencyTable entry;
|
||||
entry.currencyIndex = tableData.getIntField(0, -1);
|
||||
entry.npcminlevel = tableData.getIntField(1, -1);
|
||||
entry.minvalue = tableData.getIntField(2, -1);
|
||||
entry.maxvalue = tableData.getIntField(3, -1);
|
||||
entry.id = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDCurrencyTableTable::~CDCurrencyTableTable(void) { }
|
||||
CDCurrencyTableTable::~CDCurrencyTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDCurrencyTableTable::GetName(void) const {
|
||||
return "CurrencyTable";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDCurrencyTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,44 +8,44 @@
|
||||
\brief Contains data for the CurrencyTable table
|
||||
*/
|
||||
|
||||
//! CurrencyTable Struct
|
||||
//! CurrencyTable Struct
|
||||
struct CDCurrencyTable {
|
||||
unsigned int currencyIndex; //!< The Currency Index
|
||||
unsigned int npcminlevel; //!< The minimum level of the npc
|
||||
unsigned int minvalue; //!< The minimum currency
|
||||
unsigned int maxvalue; //!< The maximum currency
|
||||
unsigned int id; //!< The ID of the currency index
|
||||
unsigned int currencyIndex; //!< The Currency Index
|
||||
unsigned int npcminlevel; //!< The minimum level of the npc
|
||||
unsigned int minvalue; //!< The minimum currency
|
||||
unsigned int maxvalue; //!< The maximum currency
|
||||
unsigned int id; //!< The ID of the currency index
|
||||
};
|
||||
|
||||
//! CurrencyTable table
|
||||
class CDCurrencyTableTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDCurrencyTable> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
@@ -2,66 +2,66 @@
|
||||
|
||||
//! Constructor
|
||||
CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM DestructibleComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDDestructibleComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.faction = tableData.getIntField(1, -1);
|
||||
entry.factionList = tableData.getStringField(2, "");
|
||||
entry.life = tableData.getIntField(3, -1);
|
||||
entry.imagination = tableData.getIntField(4, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(5, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(6, -1);
|
||||
entry.level = tableData.getIntField(7, -1);
|
||||
entry.armor = tableData.getFloatField(8, -1.0f);
|
||||
entry.death_behavior = tableData.getIntField(9, -1);
|
||||
entry.isnpc = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.attack_priority = tableData.getIntField(11, -1);
|
||||
entry.isSmashable = tableData.getIntField(12, -1) == 1 ? true : false;
|
||||
entry.difficultyLevel = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDDestructibleComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.faction = tableData.getIntField(1, -1);
|
||||
entry.factionList = tableData.getStringField(2, "");
|
||||
entry.life = tableData.getIntField(3, -1);
|
||||
entry.imagination = tableData.getIntField(4, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(5, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(6, -1);
|
||||
entry.level = tableData.getIntField(7, -1);
|
||||
entry.armor = tableData.getFloatField(8, -1.0f);
|
||||
entry.death_behavior = tableData.getIntField(9, -1);
|
||||
entry.isnpc = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.attack_priority = tableData.getIntField(11, -1);
|
||||
entry.isSmashable = tableData.getIntField(12, -1) == 1 ? true : false;
|
||||
entry.difficultyLevel = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) { }
|
||||
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDDestructibleComponentTable::GetName(void) const {
|
||||
return "DestructibleComponent";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,53 +8,53 @@
|
||||
\brief Contains data for the DestructibleComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
//! ItemComponent Struct
|
||||
struct CDDestructibleComponent {
|
||||
unsigned int id; //!< The component ID from the ComponentsRegistry Table
|
||||
int faction; //!< The Faction ID of the object
|
||||
std::string factionList; //!< A list of the faction IDs
|
||||
int life; //!< The amount of life of the object
|
||||
unsigned int imagination; //!< The amount of imagination of the object
|
||||
int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
int CurrencyIndex; //!< The Currency Index
|
||||
unsigned int level; //!< ???
|
||||
float armor; //!< The amount of armor of the object
|
||||
unsigned int death_behavior; //!< The behavior ID of the death behavior
|
||||
bool isnpc; //!< Whether or not the object is an NPC
|
||||
unsigned int attack_priority; //!< ???
|
||||
bool isSmashable; //!< Whether or not the object is smashable
|
||||
int difficultyLevel; //!< ???
|
||||
unsigned int id; //!< The component ID from the ComponentsRegistry Table
|
||||
int faction; //!< The Faction ID of the object
|
||||
std::string factionList; //!< A list of the faction IDs
|
||||
int life; //!< The amount of life of the object
|
||||
unsigned int imagination; //!< The amount of imagination of the object
|
||||
int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
int CurrencyIndex; //!< The Currency Index
|
||||
unsigned int level; //!< ???
|
||||
float armor; //!< The amount of armor of the object
|
||||
unsigned int death_behavior; //!< The behavior ID of the death behavior
|
||||
bool isnpc; //!< Whether or not the object is an NPC
|
||||
unsigned int attack_priority; //!< ???
|
||||
bool isSmashable; //!< Whether or not the object is smashable
|
||||
int difficultyLevel; //!< ???
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDDestructibleComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDDestructibleComponent> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
@@ -2,43 +2,43 @@
|
||||
|
||||
//! Constructor
|
||||
CDEmoteTableTable::CDEmoteTableTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
||||
while (!tableData.eof()) {
|
||||
CDEmoteTable* entry = new CDEmoteTable();
|
||||
entry->ID = tableData.getIntField(0, -1);
|
||||
entry->animationName = tableData.getStringField(1, "");
|
||||
entry->iconFilename = tableData.getStringField(2, "");
|
||||
entry->channel = tableData.getIntField(3, -1);
|
||||
entry->locked = tableData.getIntField(5, -1) != 0;
|
||||
entry->localize = tableData.getIntField(6, -1) != 0;
|
||||
entry->locState = tableData.getIntField(7, -1);
|
||||
entry->gateVersion = tableData.getIntField(8, -1);
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
||||
while (!tableData.eof()) {
|
||||
CDEmoteTable* entry = new CDEmoteTable();
|
||||
entry->ID = tableData.getIntField(0, -1);
|
||||
entry->animationName = tableData.getStringField(1, "");
|
||||
entry->iconFilename = tableData.getStringField(2, "");
|
||||
entry->channel = tableData.getIntField(3, -1);
|
||||
entry->locked = tableData.getIntField(5, -1) != 0;
|
||||
entry->localize = tableData.getIntField(6, -1) != 0;
|
||||
entry->locState = tableData.getIntField(7, -1);
|
||||
entry->gateVersion = tableData.getIntField(8, -1);
|
||||
|
||||
entries.insert(std::make_pair(entry->ID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
entries.insert(std::make_pair(entry->ID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDEmoteTableTable::~CDEmoteTableTable(void) {
|
||||
for (auto e : entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
for (auto e : entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDEmoteTableTable::GetName(void) const {
|
||||
return "Emotes";
|
||||
return "Emotes";
|
||||
}
|
||||
|
||||
CDEmoteTable * CDEmoteTableTable::GetEmote(int id) {
|
||||
for (auto e : entries) {
|
||||
if (e.first == id) return e.second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
||||
for (auto e : entries) {
|
||||
if (e.first == id) return e.second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
\brief Contains data for the CDEmoteTable table
|
||||
*/
|
||||
|
||||
//! CDEmoteEntry Struct
|
||||
//! CDEmoteEntry Struct
|
||||
struct CDEmoteTable {
|
||||
CDEmoteTable() {
|
||||
ID = -1;
|
||||
@@ -22,35 +22,35 @@ struct CDEmoteTable {
|
||||
gateVersion = -1;
|
||||
}
|
||||
|
||||
int ID;
|
||||
std::string animationName;
|
||||
std::string iconFilename;
|
||||
int locState;
|
||||
int channel;
|
||||
bool locked;
|
||||
bool localize;
|
||||
int gateVersion;
|
||||
int ID;
|
||||
std::string animationName;
|
||||
std::string iconFilename;
|
||||
int locState;
|
||||
int channel;
|
||||
bool locked;
|
||||
bool localize;
|
||||
int gateVersion;
|
||||
};
|
||||
|
||||
//! CDEmoteTable table
|
||||
class CDEmoteTableTable : public CDTable {
|
||||
private:
|
||||
std::map<int, CDEmoteTable*> entries;
|
||||
std::map<int, CDEmoteTable*> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDEmoteTableTable(void);
|
||||
//! Constructor
|
||||
CDEmoteTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~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
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Returns an emote by ID
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
};
|
||||
|
@@ -2,70 +2,67 @@
|
||||
|
||||
//! Constructor
|
||||
CDFeatureGatingTable::CDFeatureGatingTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM FeatureGating");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM FeatureGating");
|
||||
while (!tableData.eof()) {
|
||||
CDFeatureGating entry;
|
||||
entry.featureName = tableData.getStringField(0, "");
|
||||
entry.major = tableData.getIntField(1, -1);
|
||||
entry.current = tableData.getIntField(2, -1);
|
||||
entry.minor = tableData.getIntField(3, -1);
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM FeatureGating");
|
||||
while (!tableData.eof()) {
|
||||
CDFeatureGating entry;
|
||||
entry.featureName = tableData.getStringField(0, "");
|
||||
entry.major = tableData.getIntField(1, -1);
|
||||
entry.current = tableData.getIntField(2, -1);
|
||||
entry.minor = tableData.getIntField(3, -1);
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDFeatureGatingTable::~CDFeatureGatingTable(void) { }
|
||||
CDFeatureGatingTable::~CDFeatureGatingTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDFeatureGatingTable::GetName(void) const {
|
||||
return "FeatureGating";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDFeatureGating> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.featureName == feature)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.featureName == feature) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -7,46 +7,46 @@
|
||||
\file CDFeatureGatingTable.hpp
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
//! ItemComponent Struct
|
||||
struct CDFeatureGating {
|
||||
std::string featureName;
|
||||
int32_t major;
|
||||
int32_t current;
|
||||
int32_t minor;
|
||||
std::string description;
|
||||
std::string featureName;
|
||||
int32_t major;
|
||||
int32_t current;
|
||||
int32_t minor;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDFeatureGatingTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
bool FeatureUnlocked(const std::string& feature) const;
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDFeatureGating> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
@@ -2,56 +2,56 @@
|
||||
|
||||
//! Constructor
|
||||
CDInventoryComponentTable::CDInventoryComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM InventoryComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM InventoryComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDInventoryComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(1, -1);
|
||||
entry.count = tableData.getIntField(2, -1);
|
||||
entry.equip = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM InventoryComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDInventoryComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(1, -1);
|
||||
entry.count = tableData.getIntField(2, -1);
|
||||
entry.equip = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDInventoryComponentTable::~CDInventoryComponentTable(void) { }
|
||||
CDInventoryComponentTable::~CDInventoryComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDInventoryComponentTable::GetName(void) const {
|
||||
return "InventoryComponent";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDInventoryComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,43 +8,43 @@
|
||||
\brief Contains data for the InventoryComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
//! ItemComponent Struct
|
||||
struct CDInventoryComponent {
|
||||
unsigned int id; //!< The component ID for this object
|
||||
unsigned int itemid; //!< The LOT of the object
|
||||
unsigned int count; //!< The count of the items the object has
|
||||
bool equip; //!< Whether or not to equip the item
|
||||
unsigned int id; //!< The component ID for this object
|
||||
unsigned int itemid; //!< The LOT of the object
|
||||
unsigned int count; //!< The count of the items the object has
|
||||
bool equip; //!< Whether or not to equip the item
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDInventoryComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDInventoryComponent> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
@@ -5,84 +5,84 @@ CDItemComponent CDItemComponentTable::Default = {};
|
||||
|
||||
//! Constructor
|
||||
CDItemComponentTable::CDItemComponentTable(void) {
|
||||
Default = CDItemComponent();
|
||||
|
||||
Default = CDItemComponent();
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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");
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
entry.audioEventUse = tableData.getStringField(32, "");
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
entry.audioEquipMetaEventSet = tableData.getStringField(36, "");
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
entry.ingredientInfo = tableData.getStringField(38, "");
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
entry.audioEventUse = tableData.getStringField(32, "");
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
entry.audioEquipMetaEventSet = tableData.getStringField(36, "");
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
entry.ingredientInfo = tableData.getStringField(38, "");
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemComponentTable::~CDItemComponentTable(void) { }
|
||||
CDItemComponentTable::~CDItemComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemComponentTable::GetName(void) const {
|
||||
return "ItemComponent";
|
||||
return "ItemComponent";
|
||||
}
|
||||
|
||||
const CDItemComponent & CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
|
||||
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
|
||||
const auto& it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
@@ -94,59 +94,59 @@ const CDItemComponent & CDItemComponentTable::GetItemComponentByID(unsigned int
|
||||
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(skillID);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
if (tableData.eof()) {
|
||||
if (tableData.eof()) {
|
||||
entries.insert(std::make_pair(skillID, Default));
|
||||
return Default;
|
||||
}
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField(32, ""));
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField(36, ""));
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField(38, ""));
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField(32, ""));
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField(36, ""));
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField(38, ""));
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
}
|
||||
|
||||
const auto& it2 = this->entries.find(skillID);
|
||||
if (it2 != this->entries.end()) {
|
||||
@@ -154,26 +154,26 @@ const CDItemComponent & CDItemComponentTable::GetItemComponentByID(unsigned int
|
||||
}
|
||||
#endif
|
||||
|
||||
return Default;
|
||||
return Default;
|
||||
}
|
||||
|
||||
std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDItemComponent& itemComponent) {
|
||||
std::map<LOT, uint32_t> currencies = {};
|
||||
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, ':');
|
||||
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])
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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;
|
||||
return currencies;
|
||||
}
|
||||
|
@@ -9,75 +9,75 @@
|
||||
\brief Contains data for the ItemComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
//! ItemComponent Struct
|
||||
struct CDItemComponent {
|
||||
unsigned int id; //!< The Component ID
|
||||
std::string equipLocation; //!< The equip location
|
||||
unsigned int baseValue; //!< The monetary base value of the item
|
||||
bool isKitPiece; //!< Whether or not the item belongs to a kit
|
||||
unsigned int rarity; //!< The rarity of the item
|
||||
unsigned int 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; //!< ???
|
||||
unsigned int reqFlagID; //!< User must have completed this flag to get the item
|
||||
unsigned int reqSpecialtyID; //!< ???
|
||||
unsigned int reqSpecRank; //!< ???
|
||||
unsigned int reqAchievementID; //!< The required achievement must be completed
|
||||
unsigned int stackSize; //!< The stack size of the item
|
||||
unsigned int color1; //!< Something to do with item color...
|
||||
unsigned int decal; //!< The decal of the item
|
||||
unsigned int offsetGroupID; //!< Something to do with group IDs
|
||||
unsigned int buildTypes; //!< Something to do with building
|
||||
std::string reqPrecondition; //!< The required precondition
|
||||
unsigned int animationFlag; //!< The Animation Flag
|
||||
unsigned int equipEffects; //!< The effect played when the item is equipped
|
||||
bool readyForQA; //!< ???
|
||||
unsigned int itemRating; //!< ???
|
||||
bool isTwoHanded; //!< Whether or not the item is double handed
|
||||
unsigned int minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
|
||||
unsigned int delResIndex; //!< ???
|
||||
unsigned int currencyLOT; //!< ???
|
||||
unsigned int 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
|
||||
unsigned int commendationLOT; //!< The commendation LOT
|
||||
unsigned int commendationCost; //!< The commendation cost
|
||||
UNUSED(std::string audioEquipMetaEventSet); //!< ???
|
||||
std::string currencyCosts; //!< Used for crafting
|
||||
UNUSED(std::string ingredientInfo); //!< Unused
|
||||
unsigned int locStatus; //!< ???
|
||||
unsigned int forgeType; //!< Forge Type
|
||||
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
|
||||
unsigned int id; //!< The Component ID
|
||||
std::string equipLocation; //!< The equip location
|
||||
unsigned int baseValue; //!< The monetary base value of the item
|
||||
bool isKitPiece; //!< Whether or not the item belongs to a kit
|
||||
unsigned int rarity; //!< The rarity of the item
|
||||
unsigned int 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; //!< ???
|
||||
unsigned int reqFlagID; //!< User must have completed this flag to get the item
|
||||
unsigned int reqSpecialtyID; //!< ???
|
||||
unsigned int reqSpecRank; //!< ???
|
||||
unsigned int reqAchievementID; //!< The required achievement must be completed
|
||||
unsigned int stackSize; //!< The stack size of the item
|
||||
unsigned int color1; //!< Something to do with item color...
|
||||
unsigned int decal; //!< The decal of the item
|
||||
unsigned int offsetGroupID; //!< Something to do with group IDs
|
||||
unsigned int buildTypes; //!< Something to do with building
|
||||
std::string reqPrecondition; //!< The required precondition
|
||||
unsigned int animationFlag; //!< The Animation Flag
|
||||
unsigned int equipEffects; //!< The effect played when the item is equipped
|
||||
bool readyForQA; //!< ???
|
||||
unsigned int itemRating; //!< ???
|
||||
bool isTwoHanded; //!< Whether or not the item is double handed
|
||||
unsigned int minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
|
||||
unsigned int delResIndex; //!< ???
|
||||
unsigned int currencyLOT; //!< ???
|
||||
unsigned int 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
|
||||
unsigned int commendationLOT; //!< The commendation LOT
|
||||
unsigned int commendationCost; //!< The commendation cost
|
||||
UNUSED(std::string audioEquipMetaEventSet); //!< ???
|
||||
std::string currencyCosts; //!< Used for crafting
|
||||
UNUSED(std::string ingredientInfo); //!< Unused
|
||||
unsigned int locStatus; //!< ???
|
||||
unsigned int forgeType; //!< Forge Type
|
||||
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDItemComponentTable : public CDTable {
|
||||
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;
|
||||
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;
|
||||
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
|
||||
|
||||
static CDItemComponent Default;
|
||||
|
||||
static CDItemComponent Default;
|
||||
};
|
||||
|
@@ -2,63 +2,62 @@
|
||||
|
||||
//! Constructor
|
||||
CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSetSkills");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSetSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSetSkills entry;
|
||||
entry.SkillSetID = tableData.getIntField(0, -1);
|
||||
entry.SkillID = tableData.getIntField(1, -1);
|
||||
entry.SkillCastType = tableData.getIntField(2, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSetSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSetSkills entry;
|
||||
entry.SkillSetID = tableData.getIntField(0, -1);
|
||||
entry.SkillID = tableData.getIntField(1, -1);
|
||||
entry.SkillCastType = tableData.getIntField(2, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) { }
|
||||
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemSetSkillsTable::GetName(void) const {
|
||||
return "ItemSetSkills";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDItemSetSkills> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(unsigned int SkillSetID)
|
||||
{
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(unsigned int SkillSetID) {
|
||||
std::vector<CDItemSetSkills> toReturn;
|
||||
|
||||
|
||||
for (CDItemSetSkills entry : this->entries) {
|
||||
if (entry.SkillSetID == SkillSetID) toReturn.push_back(entry);
|
||||
if (entry.SkillSetID > SkillSetID) return toReturn; //stop seeking in the db if it's not needed.
|
||||
|
@@ -8,45 +8,45 @@
|
||||
\brief Contains data for the ItemSetSkills table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
//! ZoneTable Struct
|
||||
struct CDItemSetSkills {
|
||||
unsigned int SkillSetID; //!< The skill set ID
|
||||
unsigned int SkillID; //!< The skill ID
|
||||
unsigned int SkillCastType; //!< The skill cast type
|
||||
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 {
|
||||
private:
|
||||
std::vector<CDItemSetSkills> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
@@ -2,67 +2,67 @@
|
||||
|
||||
//! Constructor
|
||||
CDItemSetsTable::CDItemSetsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSets");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSets entry;
|
||||
entry.setID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.itemIDs = tableData.getStringField(2, "");
|
||||
entry.kitType = tableData.getIntField(3, -1);
|
||||
entry.kitRank = tableData.getIntField(4, -1);
|
||||
entry.kitImage = tableData.getIntField(5, -1);
|
||||
entry.skillSetWith2 = tableData.getIntField(6, -1);
|
||||
entry.skillSetWith3 = tableData.getIntField(7, -1);
|
||||
entry.skillSetWith4 = tableData.getIntField(8, -1);
|
||||
entry.skillSetWith5 = tableData.getIntField(9, -1);
|
||||
entry.skillSetWith6 = tableData.getIntField(10, -1);
|
||||
entry.localize = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.kitID = tableData.getIntField(13, -1);
|
||||
entry.priority = tableData.getFloatField(14, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSets entry;
|
||||
entry.setID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.itemIDs = tableData.getStringField(2, "");
|
||||
entry.kitType = tableData.getIntField(3, -1);
|
||||
entry.kitRank = tableData.getIntField(4, -1);
|
||||
entry.kitImage = tableData.getIntField(5, -1);
|
||||
entry.skillSetWith2 = tableData.getIntField(6, -1);
|
||||
entry.skillSetWith3 = tableData.getIntField(7, -1);
|
||||
entry.skillSetWith4 = tableData.getIntField(8, -1);
|
||||
entry.skillSetWith5 = tableData.getIntField(9, -1);
|
||||
entry.skillSetWith6 = tableData.getIntField(10, -1);
|
||||
entry.localize = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.kitID = tableData.getIntField(13, -1);
|
||||
entry.priority = tableData.getFloatField(14, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemSetsTable::~CDItemSetsTable(void) { }
|
||||
CDItemSetsTable::~CDItemSetsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemSetsTable::GetName(void) const {
|
||||
return "ItemSets";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDItemSets> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,55 +8,55 @@
|
||||
\brief Contains data for the ItemSets table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
//! ZoneTable Struct
|
||||
struct CDItemSets {
|
||||
unsigned int setID; //!< The item set ID
|
||||
unsigned int locStatus; //!< The loc status
|
||||
std::string itemIDs; //!< THe item IDs
|
||||
unsigned int kitType; //!< The item kit type
|
||||
unsigned int kitRank; //!< The item kit rank
|
||||
unsigned int kitImage; //!< The item kit image
|
||||
unsigned int skillSetWith2; //!< The skill set with 2
|
||||
unsigned int skillSetWith3; //!< The skill set with 3
|
||||
unsigned int skillSetWith4; //!< The skill set with 4
|
||||
unsigned int skillSetWith5; //!< The skill set with 5
|
||||
unsigned int skillSetWith6; //!< The skill set with 6
|
||||
bool localize; //!< Whether or localize
|
||||
std::string gate_version; //!< The gate version
|
||||
unsigned int kitID; //!< The kit ID
|
||||
float priority; //!< The priority
|
||||
unsigned int setID; //!< The item set ID
|
||||
unsigned int locStatus; //!< The loc status
|
||||
std::string itemIDs; //!< THe item IDs
|
||||
unsigned int kitType; //!< The item kit type
|
||||
unsigned int kitRank; //!< The item kit rank
|
||||
unsigned int kitImage; //!< The item kit image
|
||||
unsigned int skillSetWith2; //!< The skill set with 2
|
||||
unsigned int skillSetWith3; //!< The skill set with 3
|
||||
unsigned int skillSetWith4; //!< The skill set with 4
|
||||
unsigned int skillSetWith5; //!< The skill set with 5
|
||||
unsigned int skillSetWith6; //!< The skill set with 6
|
||||
bool localize; //!< Whether or localize
|
||||
std::string gate_version; //!< The gate version
|
||||
unsigned int kitID; //!< The kit ID
|
||||
float priority; //!< The priority
|
||||
};
|
||||
|
||||
//! ItemSets table
|
||||
class CDItemSetsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDItemSets> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -2,55 +2,55 @@
|
||||
|
||||
//! Constructor
|
||||
CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LevelProgressionLookup");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LevelProgressionLookup");
|
||||
while (!tableData.eof()) {
|
||||
CDLevelProgressionLookup entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.requiredUScore = tableData.getIntField(1, -1);
|
||||
entry.BehaviorEffect = tableData.getStringField(2, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LevelProgressionLookup");
|
||||
while (!tableData.eof()) {
|
||||
CDLevelProgressionLookup entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.requiredUScore = tableData.getIntField(1, -1);
|
||||
entry.BehaviorEffect = tableData.getStringField(2, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) { }
|
||||
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLevelProgressionLookupTable::GetName(void) const {
|
||||
return "LevelProgressionLookup";
|
||||
return "LevelProgressionLookup";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {
|
||||
|
||||
std::vector<CDLevelProgressionLookup> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDLevelProgressionLookup> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,42 +8,42 @@
|
||||
\brief Contains data for the LevelProgressionLookup table
|
||||
*/
|
||||
|
||||
//! LevelProgressionLookup Entry Struct
|
||||
//! 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
|
||||
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 {
|
||||
private:
|
||||
std::vector<CDLevelProgressionLookup> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
@@ -2,61 +2,61 @@
|
||||
|
||||
//! Constructor
|
||||
CDLootMatrixTable::CDLootMatrixTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootMatrix");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootMatrix");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
|
||||
while (!tableData.eof()) {
|
||||
CDLootMatrix entry;
|
||||
entry.LootMatrixIndex = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(2, -1);
|
||||
entry.percent = tableData.getFloatField(3, -1.0f);
|
||||
entry.minToDrop = tableData.getIntField(4, -1);
|
||||
entry.maxToDrop = tableData.getIntField(5, -1);
|
||||
entry.id = tableData.getIntField(6, -1);
|
||||
entry.flagID = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(8, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
|
||||
while (!tableData.eof()) {
|
||||
CDLootMatrix entry;
|
||||
entry.LootMatrixIndex = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(2, -1);
|
||||
entry.percent = tableData.getFloatField(3, -1.0f);
|
||||
entry.minToDrop = tableData.getIntField(4, -1);
|
||||
entry.maxToDrop = tableData.getIntField(5, -1);
|
||||
entry.id = tableData.getIntField(6, -1);
|
||||
entry.flagID = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(8, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLootMatrixTable::~CDLootMatrixTable(void) { }
|
||||
CDLootMatrixTable::~CDLootMatrixTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLootMatrixTable::GetName(void) const {
|
||||
return "LootMatrix";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDLootMatrix> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,49 +8,49 @@
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! LootMatrix Struct
|
||||
//! LootMatrix Struct
|
||||
struct CDLootMatrix {
|
||||
unsigned int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
unsigned int RarityTableIndex; //!< The Rarity Table Index
|
||||
float percent; //!< The percent that this matrix is used?
|
||||
unsigned int minToDrop; //!< The minimum amount of loot from this matrix to drop
|
||||
unsigned int maxToDrop; //!< The maximum amount of loot from this matrix to drop
|
||||
unsigned int id; //!< The ID of the Loot Matrix
|
||||
unsigned int flagID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
unsigned int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
unsigned int RarityTableIndex; //!< The Rarity Table Index
|
||||
float percent; //!< The percent that this matrix is used?
|
||||
unsigned int minToDrop; //!< The minimum amount of loot from this matrix to drop
|
||||
unsigned int maxToDrop; //!< The maximum amount of loot from this matrix to drop
|
||||
unsigned int id; //!< The ID of the Loot Matrix
|
||||
unsigned int flagID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDLootMatrixTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDLootMatrix> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -2,58 +2,58 @@
|
||||
|
||||
//! Constructor
|
||||
CDLootTableTable::CDLootTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
|
||||
while (!tableData.eof()) {
|
||||
CDLootTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.id = tableData.getIntField(2, -1);
|
||||
entry.MissionDrop = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.sortPriority = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
|
||||
while (!tableData.eof()) {
|
||||
CDLootTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.id = tableData.getIntField(2, -1);
|
||||
entry.MissionDrop = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.sortPriority = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLootTableTable::~CDLootTableTable(void) { }
|
||||
CDLootTableTable::~CDLootTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLootTableTable::GetName(void) const {
|
||||
return "LootTable";
|
||||
return "LootTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) {
|
||||
|
||||
std::vector<CDLootTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDLootTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDLootTable>& CDLootTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,45 +8,45 @@
|
||||
\brief Contains data for the LootTable table
|
||||
*/
|
||||
|
||||
//! LootTable Struct
|
||||
//! LootTable Struct
|
||||
struct CDLootTable {
|
||||
unsigned int itemid; //!< The LOT of the item
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
unsigned int id; //!< The ID
|
||||
bool MissionDrop; //!< Whether or not this loot table is a mission drop
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
unsigned int itemid; //!< The LOT of the item
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
unsigned int id; //!< The ID
|
||||
bool MissionDrop; //!< Whether or not this loot table is a mission drop
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
};
|
||||
|
||||
//! LootTable table
|
||||
class CDLootTableTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDLootTable> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -3,59 +3,59 @@
|
||||
//! Constructor
|
||||
CDMissionEmailTable::CDMissionEmailTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionEmail");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionEmail");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionEmail");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionEmail entry;
|
||||
entry.ID = tableData.getIntField(0, -1);
|
||||
entry.messageType = tableData.getIntField(1, -1);
|
||||
entry.notificationGroup = tableData.getIntField(2, -1);
|
||||
entry.missionID = tableData.getIntField(3, -1);
|
||||
entry.attachmentLOT = tableData.getIntField(4, 0);
|
||||
entry.localize = (bool)tableData.getIntField(5, -1);
|
||||
entry.locStatus = tableData.getIntField(6, -1);
|
||||
entry.gate_version = tableData.getStringField(7, "");
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionEmail");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionEmail entry;
|
||||
entry.ID = tableData.getIntField(0, -1);
|
||||
entry.messageType = tableData.getIntField(1, -1);
|
||||
entry.notificationGroup = tableData.getIntField(2, -1);
|
||||
entry.missionID = tableData.getIntField(3, -1);
|
||||
entry.attachmentLOT = tableData.getIntField(4, 0);
|
||||
entry.localize = (bool)tableData.getIntField(5, -1);
|
||||
entry.locStatus = tableData.getIntField(6, -1);
|
||||
entry.gate_version = tableData.getStringField(7, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionEmailTable::~CDMissionEmailTable(void) { }
|
||||
CDMissionEmailTable::~CDMissionEmailTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionEmailTable::GetName(void) const {
|
||||
return "MissionEmail";
|
||||
return "MissionEmail";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {
|
||||
|
||||
std::vector<CDMissionEmail> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
std::vector<CDMissionEmail> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -10,46 +10,46 @@
|
||||
|
||||
//! MissionEmail Entry Struct
|
||||
struct CDMissionEmail {
|
||||
unsigned int ID;
|
||||
unsigned int messageType;
|
||||
unsigned int notificationGroup;
|
||||
unsigned int missionID;
|
||||
unsigned int attachmentLOT;
|
||||
bool localize;
|
||||
unsigned int locStatus;
|
||||
std::string gate_version;
|
||||
unsigned int ID;
|
||||
unsigned int messageType;
|
||||
unsigned int notificationGroup;
|
||||
unsigned int missionID;
|
||||
unsigned int attachmentLOT;
|
||||
bool localize;
|
||||
unsigned int locStatus;
|
||||
std::string gate_version;
|
||||
};
|
||||
|
||||
|
||||
//! MissionEmail table
|
||||
class CDMissionEmailTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissionEmail> entries;
|
||||
std::vector<CDMissionEmail> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionEmailTable(void);
|
||||
//! Constructor
|
||||
CDMissionEmailTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionEmailTable(void);
|
||||
//! Destructor
|
||||
~CDMissionEmailTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
//! 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<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
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;
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMissionEmail> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
@@ -2,57 +2,57 @@
|
||||
|
||||
//! Constructor
|
||||
CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionNPCComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionNPCComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionNPCComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.missionID = tableData.getIntField(1, -1);
|
||||
entry.offersMission = tableData.getIntField(2, -1) == 1 ? true : false;
|
||||
entry.acceptsMission = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionNPCComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionNPCComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.missionID = tableData.getIntField(1, -1);
|
||||
entry.offersMission = tableData.getIntField(2, -1) == 1 ? true : false;
|
||||
entry.acceptsMission = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) { }
|
||||
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionNPCComponentTable::GetName(void) const {
|
||||
return "MissionNPCComponent";
|
||||
return "MissionNPCComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {
|
||||
|
||||
std::vector<CDMissionNPCComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDMissionNPCComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,45 +8,45 @@
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! MissionNPCComponent Struct
|
||||
//! MissionNPCComponent Struct
|
||||
struct CDMissionNPCComponent {
|
||||
unsigned int id; //!< The ID
|
||||
unsigned int 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
|
||||
unsigned int id; //!< The ID
|
||||
unsigned int 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
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDMissionNPCComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissionNPCComponent> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> GetEntries(void) const;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -2,82 +2,79 @@
|
||||
|
||||
//! Constructor
|
||||
CDMissionTasksTable::CDMissionTasksTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionTasks");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionTasks");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionTasks entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.taskType = tableData.getIntField(2, -1);
|
||||
entry.target = tableData.getIntField(3, -1);
|
||||
entry.targetGroup = tableData.getStringField(4, "");
|
||||
entry.targetValue = tableData.getIntField(5, -1);
|
||||
entry.taskParam1 = tableData.getStringField(6, "");
|
||||
UNUSED(entry.largeTaskIcon = tableData.getStringField(7, ""));
|
||||
UNUSED(entry.IconID = tableData.getIntField(8, -1));
|
||||
entry.uid = tableData.getIntField(9, -1);
|
||||
UNUSED(entry.largeTaskIconID = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.localize = tableData.getIntField(11, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionTasks");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionTasks entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.taskType = tableData.getIntField(2, -1);
|
||||
entry.target = tableData.getIntField(3, -1);
|
||||
entry.targetGroup = tableData.getStringField(4, "");
|
||||
entry.targetValue = tableData.getIntField(5, -1);
|
||||
entry.taskParam1 = tableData.getStringField(6, "");
|
||||
UNUSED(entry.largeTaskIcon = tableData.getStringField(7, ""));
|
||||
UNUSED(entry.IconID = tableData.getIntField(8, -1));
|
||||
entry.uid = tableData.getIntField(9, -1);
|
||||
UNUSED(entry.largeTaskIconID = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.localize = tableData.getIntField(11, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionTasksTable::~CDMissionTasksTable(void) { }
|
||||
CDMissionTasksTable::~CDMissionTasksTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionTasksTable::GetName(void) const {
|
||||
return "MissionTasks";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDMissionTasks> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missionID)
|
||||
{
|
||||
std::vector<CDMissionTasks*> tasks;
|
||||
std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missionID) {
|
||||
std::vector<CDMissionTasks*> tasks;
|
||||
|
||||
for (auto& entry : this->entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
CDMissionTasks* task = const_cast<CDMissionTasks*>(&entry);
|
||||
for (auto& entry : this->entries) {
|
||||
if (entry.id == missionID) {
|
||||
CDMissionTasks* task = const_cast<CDMissionTasks*>(&entry);
|
||||
|
||||
tasks.push_back(task);
|
||||
}
|
||||
}
|
||||
tasks.push_back(task);
|
||||
}
|
||||
}
|
||||
|
||||
return tasks;
|
||||
return tasks;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,54 +8,54 @@
|
||||
\brief Contains data for the MissionTasks table
|
||||
*/
|
||||
|
||||
//! ObjectSkills Struct
|
||||
//! ObjectSkills Struct
|
||||
struct CDMissionTasks {
|
||||
unsigned int id; //!< The Mission ID that the task belongs to
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
unsigned int taskType; //!< The task type
|
||||
unsigned int target; //!< The mission target
|
||||
std::string targetGroup; //!< The mission target group
|
||||
int targetValue; //!< The target value
|
||||
std::string taskParam1; //!< The task param 1
|
||||
UNUSED(std::string largeTaskIcon); //!< ???
|
||||
UNUSED(unsigned int IconID); //!< ???
|
||||
unsigned int uid; //!< ???
|
||||
UNUSED(unsigned int largeTaskIconID); //!< ???
|
||||
UNUSED(bool localize); //!< Whether or not the task should be localized
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
unsigned int id; //!< The Mission ID that the task belongs to
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
unsigned int taskType; //!< The task type
|
||||
unsigned int target; //!< The mission target
|
||||
std::string targetGroup; //!< The mission target group
|
||||
int targetValue; //!< The target value
|
||||
std::string taskParam1; //!< The task param 1
|
||||
UNUSED(std::string largeTaskIcon); //!< ???
|
||||
UNUSED(unsigned int IconID); //!< ???
|
||||
unsigned int uid; //!< ???
|
||||
UNUSED(unsigned int largeTaskIconID); //!< ???
|
||||
UNUSED(bool localize); //!< Whether or not the task should be localized
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDMissionTasksTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
|
||||
std::vector<CDMissionTasks> entries;
|
||||
|
||||
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissionTasks>& GetEntries(void) const;
|
||||
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
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
|
@@ -4,136 +4,130 @@ CDMissions CDMissionsTable::Default = {};
|
||||
|
||||
//! Constructor
|
||||
CDMissionsTable::CDMissionsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Missions");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Missions");
|
||||
while (!tableData.eof()) {
|
||||
CDMissions entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.defined_type = tableData.getStringField(1, "");
|
||||
entry.defined_subtype = tableData.getStringField(2, "");
|
||||
entry.UISortOrder = tableData.getIntField(3, -1);
|
||||
entry.offer_objectID = tableData.getIntField(4, -1);
|
||||
entry.target_objectID = tableData.getIntField(5, -1);
|
||||
entry.reward_currency = tableData.getInt64Field(6, -1);
|
||||
entry.LegoScore = tableData.getIntField(7, -1);
|
||||
entry.reward_reputation = tableData.getIntField(8, -1);
|
||||
entry.isChoiceReward = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.reward_item1 = tableData.getIntField(10, 0);
|
||||
entry.reward_item1_count = tableData.getIntField(11, 0);
|
||||
entry.reward_item2 = tableData.getIntField(12, 0);
|
||||
entry.reward_item2_count = tableData.getIntField(13, 0);
|
||||
entry.reward_item3 = tableData.getIntField(14, 0);
|
||||
entry.reward_item3_count = tableData.getIntField(15, 0);
|
||||
entry.reward_item4 = tableData.getIntField(16, 0);
|
||||
entry.reward_item4_count = tableData.getIntField(17, 0);
|
||||
entry.reward_emote = tableData.getIntField(18, -1);
|
||||
entry.reward_emote2 = tableData.getIntField(19, -1);
|
||||
entry.reward_emote3 = tableData.getIntField(20, -1);
|
||||
entry.reward_emote4 = tableData.getIntField(21, -1);
|
||||
entry.reward_maximagination = tableData.getIntField(22, -1);
|
||||
entry.reward_maxhealth = tableData.getIntField(23, -1);
|
||||
entry.reward_maxinventory = tableData.getIntField(24, -1);
|
||||
entry.reward_maxmodel = tableData.getIntField(25, -1);
|
||||
entry.reward_maxwidget = tableData.getIntField(26, -1);
|
||||
entry.reward_maxwallet = tableData.getIntField(27, -1);
|
||||
entry.repeatable = tableData.getIntField(28, -1) == 1 ? true : false;
|
||||
entry.reward_currency_repeatable = tableData.getIntField(29, -1);
|
||||
entry.reward_item1_repeatable = tableData.getIntField(30, -1);
|
||||
entry.reward_item1_repeat_count = tableData.getIntField(31, -1);
|
||||
entry.reward_item2_repeatable = tableData.getIntField(32, -1);
|
||||
entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
|
||||
entry.reward_item3_repeatable = tableData.getIntField(34, -1);
|
||||
entry.reward_item3_repeat_count = tableData.getIntField(35, -1);
|
||||
entry.reward_item4_repeatable = tableData.getIntField(36, -1);
|
||||
entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
|
||||
entry.time_limit = tableData.getIntField(38, -1);
|
||||
entry.isMission = tableData.getIntField(39, -1) ? true : false;
|
||||
entry.missionIconID = tableData.getIntField(40, -1);
|
||||
entry.prereqMissionID = tableData.getStringField(41, "");
|
||||
entry.localize = tableData.getIntField(42, -1) == 1 ? true : false;
|
||||
entry.inMOTD = tableData.getIntField(43, -1) == 1 ? true : false;
|
||||
entry.cooldownTime = tableData.getInt64Field(44, -1);
|
||||
entry.isRandom = tableData.getIntField(45, -1) == 1 ? true : false;
|
||||
entry.randomPool = tableData.getStringField(46, "");
|
||||
entry.UIPrereqID = tableData.getIntField(47, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(48, ""));
|
||||
UNUSED(entry.HUDStates = tableData.getStringField(49, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(50, -1));
|
||||
entry.reward_bankinventory = tableData.getIntField(51, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Missions");
|
||||
while (!tableData.eof()) {
|
||||
CDMissions entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.defined_type = tableData.getStringField(1, "");
|
||||
entry.defined_subtype = tableData.getStringField(2, "");
|
||||
entry.UISortOrder = tableData.getIntField(3, -1);
|
||||
entry.offer_objectID = tableData.getIntField(4, -1);
|
||||
entry.target_objectID = tableData.getIntField(5, -1);
|
||||
entry.reward_currency = tableData.getInt64Field(6, -1);
|
||||
entry.LegoScore = tableData.getIntField(7, -1);
|
||||
entry.reward_reputation = tableData.getIntField(8, -1);
|
||||
entry.isChoiceReward = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.reward_item1 = tableData.getIntField(10, 0);
|
||||
entry.reward_item1_count = tableData.getIntField(11, 0);
|
||||
entry.reward_item2 = tableData.getIntField(12, 0);
|
||||
entry.reward_item2_count = tableData.getIntField(13, 0);
|
||||
entry.reward_item3 = tableData.getIntField(14, 0);
|
||||
entry.reward_item3_count = tableData.getIntField(15, 0);
|
||||
entry.reward_item4 = tableData.getIntField(16, 0);
|
||||
entry.reward_item4_count = tableData.getIntField(17, 0);
|
||||
entry.reward_emote = tableData.getIntField(18, -1);
|
||||
entry.reward_emote2 = tableData.getIntField(19, -1);
|
||||
entry.reward_emote3 = tableData.getIntField(20, -1);
|
||||
entry.reward_emote4 = tableData.getIntField(21, -1);
|
||||
entry.reward_maximagination = tableData.getIntField(22, -1);
|
||||
entry.reward_maxhealth = tableData.getIntField(23, -1);
|
||||
entry.reward_maxinventory = tableData.getIntField(24, -1);
|
||||
entry.reward_maxmodel = tableData.getIntField(25, -1);
|
||||
entry.reward_maxwidget = tableData.getIntField(26, -1);
|
||||
entry.reward_maxwallet = tableData.getIntField(27, -1);
|
||||
entry.repeatable = tableData.getIntField(28, -1) == 1 ? true : false;
|
||||
entry.reward_currency_repeatable = tableData.getIntField(29, -1);
|
||||
entry.reward_item1_repeatable = tableData.getIntField(30, -1);
|
||||
entry.reward_item1_repeat_count = tableData.getIntField(31, -1);
|
||||
entry.reward_item2_repeatable = tableData.getIntField(32, -1);
|
||||
entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
|
||||
entry.reward_item3_repeatable = tableData.getIntField(34, -1);
|
||||
entry.reward_item3_repeat_count = tableData.getIntField(35, -1);
|
||||
entry.reward_item4_repeatable = tableData.getIntField(36, -1);
|
||||
entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
|
||||
entry.time_limit = tableData.getIntField(38, -1);
|
||||
entry.isMission = tableData.getIntField(39, -1) ? true : false;
|
||||
entry.missionIconID = tableData.getIntField(40, -1);
|
||||
entry.prereqMissionID = tableData.getStringField(41, "");
|
||||
entry.localize = tableData.getIntField(42, -1) == 1 ? true : false;
|
||||
entry.inMOTD = tableData.getIntField(43, -1) == 1 ? true : false;
|
||||
entry.cooldownTime = tableData.getInt64Field(44, -1);
|
||||
entry.isRandom = tableData.getIntField(45, -1) == 1 ? true : false;
|
||||
entry.randomPool = tableData.getStringField(46, "");
|
||||
entry.UIPrereqID = tableData.getIntField(47, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(48, ""));
|
||||
UNUSED(entry.HUDStates = tableData.getStringField(49, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(50, -1));
|
||||
entry.reward_bankinventory = tableData.getIntField(51, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
Default.id = -1;
|
||||
Default.id = -1;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionsTable::~CDMissionsTable(void) { }
|
||||
CDMissionsTable::~CDMissionsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionsTable::GetName(void) const {
|
||||
return "Missions";
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDMissions> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
const CDMissions* CDMissionsTable::GetPtrByMissionID(uint32_t missionID) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
return const_cast<CDMissions*>(&entry);
|
||||
}
|
||||
}
|
||||
const CDMissions* CDMissionsTable::GetPtrByMissionID(uint32_t missionID) const {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == missionID) {
|
||||
return const_cast<CDMissions*>(&entry);
|
||||
}
|
||||
}
|
||||
|
||||
return &Default;
|
||||
return &Default;
|
||||
}
|
||||
|
||||
const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& found) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
found = true;
|
||||
const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& found) const {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == missionID) {
|
||||
found = true;
|
||||
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
found = false;
|
||||
found = false;
|
||||
|
||||
return Default;
|
||||
return Default;
|
||||
}
|
||||
|
@@ -10,97 +10,97 @@
|
||||
\brief Contains data for the Missions table
|
||||
*/
|
||||
|
||||
//! Missions Struct
|
||||
//! Missions Struct
|
||||
struct CDMissions {
|
||||
int id; //!< The Mission ID
|
||||
std::string defined_type; //!< The type of mission
|
||||
std::string defined_subtype; //!< The subtype of the mission
|
||||
int UISortOrder; //!< The UI Sort Order for the mission
|
||||
int offer_objectID; //!< The LOT of the mission giver
|
||||
int target_objectID; //!< The LOT of the mission's target
|
||||
int64_t reward_currency; //!< The amount of currency to reward the player
|
||||
int 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
|
||||
int reward_item1; //!< The first rewarded item
|
||||
int reward_item1_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2; //!< The second rewarded item
|
||||
int reward_item2_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3; //!< The third rewarded item
|
||||
int reward_item3_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4; //!< The fourth rewarded item
|
||||
int reward_item4_count; //!< The count of the fourth item to be rewarded
|
||||
int reward_emote; //!< The first emote to be rewarded
|
||||
int reward_emote2; //!< The second emote to be rewarded
|
||||
int reward_emote3; //!< The third emote to be rewarded
|
||||
int reward_emote4; //!< The fourth emote to be rewarded
|
||||
int reward_maximagination; //!< The amount of max imagination to reward
|
||||
int reward_maxhealth; //!< The amount of max health to reward
|
||||
int reward_maxinventory; //!< The amount of max inventory to reward
|
||||
int reward_maxmodel; //!< ???
|
||||
int reward_maxwidget; //!< ???
|
||||
int 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
|
||||
int reward_item1_repeatable; //!< The first rewarded item
|
||||
int reward_item1_repeat_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2_repeatable; //!< The second rewarded item
|
||||
int reward_item2_repeat_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3_repeatable; //!< The third rewarded item
|
||||
int reward_item3_repeat_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4_repeatable; //!< The fourth rewarded item
|
||||
int reward_item4_repeat_count; //!< The count of the fourth item to be rewarded
|
||||
int time_limit; //!< The time limit of the mission
|
||||
bool isMission; //!< Maybe to differentiate between missions and achievements?
|
||||
int 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; //!< ???
|
||||
int UIPrereqID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(std::string HUDStates); //!< ???
|
||||
UNUSED(int locStatus); //!< ???
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
int id; //!< The Mission ID
|
||||
std::string defined_type; //!< The type of mission
|
||||
std::string defined_subtype; //!< The subtype of the mission
|
||||
int UISortOrder; //!< The UI Sort Order for the mission
|
||||
int offer_objectID; //!< The LOT of the mission giver
|
||||
int target_objectID; //!< The LOT of the mission's target
|
||||
int64_t reward_currency; //!< The amount of currency to reward the player
|
||||
int 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
|
||||
int reward_item1; //!< The first rewarded item
|
||||
int reward_item1_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2; //!< The second rewarded item
|
||||
int reward_item2_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3; //!< The third rewarded item
|
||||
int reward_item3_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4; //!< The fourth rewarded item
|
||||
int reward_item4_count; //!< The count of the fourth item to be rewarded
|
||||
int reward_emote; //!< The first emote to be rewarded
|
||||
int reward_emote2; //!< The second emote to be rewarded
|
||||
int reward_emote3; //!< The third emote to be rewarded
|
||||
int reward_emote4; //!< The fourth emote to be rewarded
|
||||
int reward_maximagination; //!< The amount of max imagination to reward
|
||||
int reward_maxhealth; //!< The amount of max health to reward
|
||||
int reward_maxinventory; //!< The amount of max inventory to reward
|
||||
int reward_maxmodel; //!< ???
|
||||
int reward_maxwidget; //!< ???
|
||||
int 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
|
||||
int reward_item1_repeatable; //!< The first rewarded item
|
||||
int reward_item1_repeat_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2_repeatable; //!< The second rewarded item
|
||||
int reward_item2_repeat_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3_repeatable; //!< The third rewarded item
|
||||
int reward_item3_repeat_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4_repeatable; //!< The fourth rewarded item
|
||||
int reward_item4_repeat_count; //!< The count of the fourth item to be rewarded
|
||||
int time_limit; //!< The time limit of the mission
|
||||
bool isMission; //!< Maybe to differentiate between missions and achievements?
|
||||
int 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; //!< ???
|
||||
int UIPrereqID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(std::string HUDStates); //!< ???
|
||||
UNUSED(int locStatus); //!< ???
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
//! Missions table
|
||||
class CDMissionsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissions> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissions>& GetEntries(void) const;
|
||||
//! Constructor
|
||||
CDMissionsTable(void);
|
||||
|
||||
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
|
||||
//! Destructor
|
||||
~CDMissionsTable(void);
|
||||
|
||||
const CDMissions& GetByMissionID(uint32_t missionID, bool& found) const;
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
static CDMissions Default;
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissions>& GetEntries(void) const;
|
||||
|
||||
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
|
||||
|
||||
const CDMissions& GetByMissionID(uint32_t missionID, bool& found) const;
|
||||
|
||||
static CDMissions Default;
|
||||
};
|
||||
|
||||
|
@@ -11,9 +11,9 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
@@ -38,7 +38,7 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMovementAIComponentTable::~CDMovementAIComponentTable(void) { }
|
||||
CDMovementAIComponentTable::~CDMovementAIComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMovementAIComponentTable::GetName(void) const {
|
||||
|
@@ -2,56 +2,56 @@
|
||||
|
||||
//! Constructor
|
||||
CDObjectSkillsTable::CDObjectSkillsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ObjectSkills");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ObjectSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDObjectSkills entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.skillID = tableData.getIntField(1, -1);
|
||||
entry.castOnType = tableData.getIntField(2, -1);
|
||||
entry.AICombatWeight = tableData.getIntField(3, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ObjectSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDObjectSkills entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.skillID = tableData.getIntField(1, -1);
|
||||
entry.castOnType = tableData.getIntField(2, -1);
|
||||
entry.AICombatWeight = tableData.getIntField(3, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDObjectSkillsTable::~CDObjectSkillsTable(void) { }
|
||||
CDObjectSkillsTable::~CDObjectSkillsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDObjectSkillsTable::GetName(void) const {
|
||||
return "ObjectSkills";
|
||||
return "ObjectSkills";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) {
|
||||
|
||||
std::vector<CDObjectSkills> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDObjectSkills> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDObjectSkills> CDObjectSkillsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,44 +8,44 @@
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! ObjectSkills Struct
|
||||
//! ObjectSkills Struct
|
||||
struct CDObjectSkills {
|
||||
unsigned int objectTemplate; //!< The LOT of the item
|
||||
unsigned int skillID; //!< The Skill ID of the object
|
||||
unsigned int castOnType; //!< ???
|
||||
unsigned int AICombatWeight; //!< ???
|
||||
unsigned int objectTemplate; //!< The LOT of the item
|
||||
unsigned int skillID; //!< The Skill ID of the object
|
||||
unsigned int castOnType; //!< ???
|
||||
unsigned int AICombatWeight; //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectSkillsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDObjectSkills> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDObjectSkills> GetEntries(void) const;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDObjectSkills> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -3,39 +3,39 @@
|
||||
//! Constructor
|
||||
CDObjectsTable::CDObjectsTable(void) {
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Objects");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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");
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
entry.placeable = tableData.getIntField(2, -1);
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
entry.localize = tableData.getIntField(5, -1);
|
||||
entry.npcTemplateID = tableData.getIntField(6, -1);
|
||||
entry.displayName = tableData.getStringField(7, "");
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
entry.nametag = tableData.getIntField(9, -1);
|
||||
entry._internalNotes = tableData.getStringField(10, "");
|
||||
entry.locStatus = tableData.getIntField(11, -1);
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.HQ_valid = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Objects");
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
entry.placeable = tableData.getIntField(2, -1);
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
entry.localize = tableData.getIntField(5, -1);
|
||||
entry.npcTemplateID = tableData.getIntField(6, -1);
|
||||
entry.displayName = tableData.getStringField(7, "");
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
entry.nametag = tableData.getIntField(9, -1);
|
||||
entry._internalNotes = tableData.getStringField(10, "");
|
||||
entry.locStatus = tableData.getIntField(11, -1);
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.HQ_valid = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
@@ -44,14 +44,14 @@ CDObjectsTable::CDObjectsTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDObjectsTable::~CDObjectsTable(void) { }
|
||||
CDObjectsTable::~CDObjectsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDObjectsTable::GetName(void) const {
|
||||
return "Objects";
|
||||
return "Objects";
|
||||
}
|
||||
|
||||
const CDObjects & CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
const auto& it = this->entries.find(LOT);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
@@ -63,32 +63,32 @@ const CDObjects & CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
query << "SELECT * FROM Objects WHERE id = " << std::to_string(LOT);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
if (tableData.eof()) {
|
||||
this->entries.insert(std::make_pair(LOT, m_default));
|
||||
if (tableData.eof()) {
|
||||
this->entries.insert(std::make_pair(LOT, m_default));
|
||||
return m_default;
|
||||
}
|
||||
|
||||
// Now get the data
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
UNUSED(entry.placeable = tableData.getIntField(2, -1));
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
UNUSED(ntry.description = tableData.getStringField(4, ""));
|
||||
UNUSED(entry.localize = tableData.getIntField(5, -1));
|
||||
UNUSED(entry.npcTemplateID = tableData.getIntField(6, -1));
|
||||
UNUSED(entry.displayName = tableData.getStringField(7, ""));
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
UNUSED(entry.nametag = tableData.getIntField(9, -1));
|
||||
UNUSED(entry._internalNotes = tableData.getStringField(10, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.HQ_valid = tableData.getIntField(13, -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
// Now get the data
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
UNUSED(entry.placeable = tableData.getIntField(2, -1));
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
UNUSED(ntry.description = tableData.getStringField(4, ""));
|
||||
UNUSED(entry.localize = tableData.getIntField(5, -1));
|
||||
UNUSED(entry.npcTemplateID = tableData.getIntField(6, -1));
|
||||
UNUSED(entry.displayName = tableData.getStringField(7, ""));
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
UNUSED(entry.nametag = tableData.getIntField(9, -1));
|
||||
UNUSED(entry._internalNotes = tableData.getStringField(10, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.HQ_valid = tableData.getIntField(13, -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
@@ -99,4 +99,4 @@ const CDObjects & CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
#endif
|
||||
|
||||
return m_default;
|
||||
}
|
||||
}
|
||||
|
@@ -8,45 +8,45 @@
|
||||
\brief Contains data for the Objects table
|
||||
*/
|
||||
|
||||
//! RebuildComponent Struct
|
||||
//! RebuildComponent Struct
|
||||
struct CDObjects {
|
||||
unsigned int id; //!< The LOT of the object
|
||||
std::string name; //!< The internal name of the object
|
||||
UNUSED(unsigned int 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(unsigned int localize); //!< Whether or not the object should localize
|
||||
UNUSED(unsigned int npcTemplateID); //!< Something related to NPCs...
|
||||
UNUSED(std::string displayName); //!< The display name of the object
|
||||
float interactionDistance; //!< The interaction distance of the object
|
||||
UNUSED(unsigned int nametag); //!< ???
|
||||
UNUSED(std::string _internalNotes); //!< Some internal notes (rarely used)
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version for the object
|
||||
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
unsigned int id; //!< The LOT of the object
|
||||
std::string name; //!< The internal name of the object
|
||||
UNUSED(unsigned int 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(unsigned int localize); //!< Whether or not the object should localize
|
||||
UNUSED(unsigned int npcTemplateID); //!< Something related to NPCs...
|
||||
UNUSED(std::string displayName); //!< The display name of the object
|
||||
float interactionDistance; //!< The interaction distance of the object
|
||||
UNUSED(unsigned int nametag); //!< ???
|
||||
UNUSED(std::string _internalNotes); //!< Some internal notes (rarely used)
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version for the object
|
||||
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectsTable : public CDTable {
|
||||
private:
|
||||
//std::vector<CDObjects> entries;
|
||||
//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;
|
||||
|
||||
|
||||
//! 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
|
||||
const CDObjects& GetByID(unsigned int LOT);
|
||||
|
||||
|
@@ -11,9 +11,9 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
@@ -33,7 +33,7 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDPackageComponentTable::~CDPackageComponentTable(void) { }
|
||||
CDPackageComponentTable::~CDPackageComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDPackageComponentTable::GetName(void) const {
|
||||
@@ -53,4 +53,4 @@ std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<boo
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDPackageComponent> CDPackageComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
|
||||
CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
||||
while (!tableData.eof()) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDPhysicsComponent* entry = new CDPhysicsComponent();
|
||||
entry->id = tableData.getIntField(0, -1);
|
||||
entry->id = tableData.getIntField(0, -1);
|
||||
entry->bStatic = tableData.getIntField(1, -1) != 0;
|
||||
entry->physicsAsset = tableData.getStringField(2, "");
|
||||
UNUSED(entry->jump = tableData.getIntField(3, -1) != 0);
|
||||
@@ -22,28 +22,28 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
|
||||
UNUSED(entry->gravityVolumeAsset = tableData.getStringField(15));
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
}
|
||||
|
||||
std::string CDPhysicsComponentTable::GetName(void) const {
|
||||
return "PhysicsComponent";
|
||||
return "PhysicsComponent";
|
||||
}
|
||||
|
||||
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
||||
for (auto e : m_entries) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.first == componentID) return e.second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -23,12 +23,12 @@ struct CDPhysicsComponent {
|
||||
|
||||
class CDPhysicsComponentTable : public CDTable {
|
||||
public:
|
||||
CDPhysicsComponentTable(void);
|
||||
~CDPhysicsComponentTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
CDPhysicsComponentTable(void);
|
||||
~CDPhysicsComponentTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
CDPhysicsComponent* GetByID(unsigned int componentID);
|
||||
|
||||
private:
|
||||
std::map<unsigned int, CDPhysicsComponent*> m_entries;
|
||||
};
|
||||
};
|
||||
|
@@ -3,31 +3,31 @@
|
||||
|
||||
CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyEntranceComponent;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyEntranceComponent {
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
tableData.getStringField(2, ""),
|
||||
static_cast<bool>(tableData.getIntField(3, false)),
|
||||
tableData.getStringField(4, "")
|
||||
};
|
||||
this->entries.reserve(size);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyEntranceComponent;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyEntranceComponent{
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
tableData.getStringField(2, ""),
|
||||
static_cast<bool>(tableData.getIntField(3, false)),
|
||||
tableData.getStringField(4, "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
@@ -35,14 +35,14 @@ CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
|
||||
CDPropertyEntranceComponentTable::~CDPropertyEntranceComponentTable(void) = default;
|
||||
|
||||
std::string CDPropertyEntranceComponentTable::GetName() const {
|
||||
return "PropertyEntranceComponent";
|
||||
return "PropertyEntranceComponent";
|
||||
}
|
||||
|
||||
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
return defaultEntry;
|
||||
}
|
||||
|
@@ -2,40 +2,40 @@
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyEntranceComponent {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
std::string propertyName;
|
||||
bool isOnProperty;
|
||||
std::string groupType;
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
std::string propertyName;
|
||||
bool isOnProperty;
|
||||
std::string groupType;
|
||||
};
|
||||
|
||||
class CDPropertyEntranceComponentTable : public CDTable {
|
||||
public:
|
||||
//! Constructor
|
||||
CDPropertyEntranceComponentTable();
|
||||
//! Constructor
|
||||
CDPropertyEntranceComponentTable();
|
||||
|
||||
//! Destructor
|
||||
~CDPropertyEntranceComponentTable();
|
||||
//! Destructor
|
||||
~CDPropertyEntranceComponentTable();
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
//! 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
|
||||
*/
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
|
||||
private:
|
||||
std::vector<CDPropertyEntranceComponent> entries {};
|
||||
CDPropertyEntranceComponent defaultEntry {};
|
||||
std::vector<CDPropertyEntranceComponent> entries{};
|
||||
CDPropertyEntranceComponent defaultEntry{};
|
||||
};
|
||||
|
@@ -2,30 +2,30 @@
|
||||
|
||||
CDPropertyTemplateTable::CDPropertyTemplateTable() {
|
||||
|
||||
// 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();
|
||||
}
|
||||
|
||||
// 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();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyTemplate;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyTemplate {
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(2, -1)),
|
||||
tableData.getStringField(3, "")
|
||||
};
|
||||
this->entries.reserve(size);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyTemplate;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyTemplate{
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(2, -1)),
|
||||
tableData.getStringField(3, "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
@@ -33,14 +33,14 @@ CDPropertyTemplateTable::CDPropertyTemplateTable() {
|
||||
CDPropertyTemplateTable::~CDPropertyTemplateTable() = default;
|
||||
|
||||
std::string CDPropertyTemplateTable::GetName() const {
|
||||
return "PropertyTemplate";
|
||||
return "PropertyTemplate";
|
||||
}
|
||||
|
||||
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.mapID == mapID)
|
||||
return entry;
|
||||
}
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.mapID == mapID)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
return defaultEntry;
|
||||
}
|
||||
|
@@ -2,20 +2,20 @@
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyTemplate {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
uint32_t vendorMapID;
|
||||
std::string spawnName;
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
uint32_t vendorMapID;
|
||||
std::string spawnName;
|
||||
};
|
||||
|
||||
class CDPropertyTemplateTable : public CDTable {
|
||||
public:
|
||||
CDPropertyTemplateTable();
|
||||
~CDPropertyTemplateTable();
|
||||
CDPropertyTemplateTable();
|
||||
~CDPropertyTemplateTable();
|
||||
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
private:
|
||||
std::vector<CDPropertyTemplate> entries {};
|
||||
CDPropertyTemplate defaultEntry {};
|
||||
};
|
||||
std::vector<CDPropertyTemplate> entries{};
|
||||
CDPropertyTemplate defaultEntry{};
|
||||
};
|
||||
|
@@ -11,9 +11,9 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
@@ -34,7 +34,7 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDProximityMonitorComponentTable::~CDProximityMonitorComponentTable(void) { }
|
||||
CDProximityMonitorComponentTable::~CDProximityMonitorComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDProximityMonitorComponentTable::GetName(void) const {
|
||||
|
@@ -2,82 +2,82 @@
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RailActivatorComponent;");
|
||||
while (!tableData.eof()) {
|
||||
CDRailActivatorComponent entry;
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RailActivatorComponent;");
|
||||
while (!tableData.eof()) {
|
||||
CDRailActivatorComponent entry;
|
||||
|
||||
entry.id = tableData.getIntField(0);
|
||||
entry.id = tableData.getIntField(0);
|
||||
|
||||
std::string startAnimation(tableData.getStringField(1, ""));
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(startAnimation);
|
||||
std::string startAnimation(tableData.getStringField(1, ""));
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(startAnimation);
|
||||
|
||||
std::string loopAnimation(tableData.getStringField(2, ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(loopAnimation);
|
||||
std::string loopAnimation(tableData.getStringField(2, ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(loopAnimation);
|
||||
|
||||
std::string stopAnimation(tableData.getStringField(3, ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(stopAnimation);
|
||||
std::string stopAnimation(tableData.getStringField(3, ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(stopAnimation);
|
||||
|
||||
std::string startSound(tableData.getStringField(4, ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(startSound);
|
||||
std::string startSound(tableData.getStringField(4, ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(startSound);
|
||||
|
||||
std::string loopSound(tableData.getStringField(5, ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(loopSound);
|
||||
std::string loopSound(tableData.getStringField(5, ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(loopSound);
|
||||
|
||||
std::string stopSound(tableData.getStringField(6, ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(stopSound);
|
||||
std::string stopSound(tableData.getStringField(6, ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(stopSound);
|
||||
|
||||
std::string loopEffectString(tableData.getStringField(7, ""));
|
||||
entry.loopEffectID = EffectPairFromString(loopEffectString);
|
||||
std::string loopEffectString(tableData.getStringField(7, ""));
|
||||
entry.loopEffectID = EffectPairFromString(loopEffectString);
|
||||
|
||||
entry.preconditions = tableData.getStringField(8, "-1");
|
||||
entry.preconditions = tableData.getStringField(8, "-1");
|
||||
|
||||
entry.playerCollision = tableData.getIntField(9, 0);
|
||||
entry.playerCollision = tableData.getIntField(9, 0);
|
||||
|
||||
entry.cameraLocked = tableData.getIntField(10, 0);
|
||||
entry.cameraLocked = tableData.getIntField(10, 0);
|
||||
|
||||
std::string startEffectString(tableData.getStringField(11, ""));
|
||||
entry.startEffectID = EffectPairFromString(startEffectString);
|
||||
std::string startEffectString(tableData.getStringField(11, ""));
|
||||
entry.startEffectID = EffectPairFromString(startEffectString);
|
||||
|
||||
std::string stopEffectString(tableData.getStringField(12, ""));
|
||||
entry.stopEffectID = EffectPairFromString(stopEffectString);
|
||||
std::string stopEffectString(tableData.getStringField(12, ""));
|
||||
entry.stopEffectID = EffectPairFromString(stopEffectString);
|
||||
|
||||
entry.damageImmune = tableData.getIntField(13, 0);
|
||||
entry.damageImmune = tableData.getIntField(13, 0);
|
||||
|
||||
entry.noAggro = tableData.getIntField(14, 0);
|
||||
entry.noAggro = tableData.getIntField(14, 0);
|
||||
|
||||
entry.showNameBillboard = tableData.getIntField(15, 0);
|
||||
entry.showNameBillboard = tableData.getIntField(15, 0);
|
||||
|
||||
m_Entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
m_Entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDRailActivatorComponentTable::~CDRailActivatorComponentTable() = default;
|
||||
|
||||
std::string CDRailActivatorComponentTable::GetName() const {
|
||||
return "RailActivatorComponent";
|
||||
return "RailActivatorComponent";
|
||||
}
|
||||
|
||||
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
|
||||
for (const auto& entry : m_Entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
for (const auto& entry : m_Entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return {};
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CDRailActivatorComponent> CDRailActivatorComponentTable::GetEntries() const {
|
||||
return m_Entries;
|
||||
return m_Entries;
|
||||
}
|
||||
|
||||
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)) };
|
||||
}
|
||||
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 {};
|
||||
return {};
|
||||
}
|
||||
|
@@ -2,33 +2,33 @@
|
||||
#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;
|
||||
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 {
|
||||
public:
|
||||
CDRailActivatorComponentTable();
|
||||
~CDRailActivatorComponentTable();
|
||||
CDRailActivatorComponentTable();
|
||||
~CDRailActivatorComponentTable();
|
||||
|
||||
std::string GetName() const override;
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
|
||||
std::string GetName() const override;
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
|
||||
private:
|
||||
static std::pair<uint32_t , std::u16string> EffectPairFromString(std::string& str);
|
||||
std::vector<CDRailActivatorComponent> m_Entries {};
|
||||
static std::pair<uint32_t, std::u16string> EffectPairFromString(std::string& str);
|
||||
std::vector<CDRailActivatorComponent> m_Entries{};
|
||||
};
|
||||
|
@@ -3,55 +3,55 @@
|
||||
//! Constructor
|
||||
CDRarityTableTable::CDRarityTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RarityTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RarityTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RarityTable");
|
||||
while (!tableData.eof()) {
|
||||
CDRarityTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.randmax = tableData.getFloatField(1, -1);
|
||||
entry.rarity = tableData.getIntField(2, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(3, -1);
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RarityTable");
|
||||
while (!tableData.eof()) {
|
||||
CDRarityTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.randmax = tableData.getFloatField(1, -1);
|
||||
entry.rarity = tableData.getIntField(2, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(3, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDRarityTableTable::~CDRarityTableTable(void) { }
|
||||
CDRarityTableTable::~CDRarityTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDRarityTableTable::GetName(void) const {
|
||||
return "RarityTable";
|
||||
return "RarityTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarityTable)> predicate) {
|
||||
|
||||
std::vector<CDRarityTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
std::vector<CDRarityTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDRarityTable>& CDRarityTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -10,63 +10,59 @@
|
||||
|
||||
//! RarityTable Entry Struct
|
||||
struct CDRarityTable {
|
||||
unsigned int id;
|
||||
float randmax;
|
||||
unsigned int rarity;
|
||||
unsigned int RarityTableIndex;
|
||||
unsigned int id;
|
||||
float randmax;
|
||||
unsigned int rarity;
|
||||
unsigned int RarityTableIndex;
|
||||
|
||||
friend bool operator> (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity > c2.rarity;
|
||||
}
|
||||
friend bool operator> (const CDRarityTable& c1, const CDRarityTable& c2) {
|
||||
return c1.rarity > c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator>= (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity >= c2.rarity;
|
||||
}
|
||||
friend bool operator>= (const CDRarityTable& c1, const CDRarityTable& c2) {
|
||||
return c1.rarity >= c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator< (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity < c2.rarity;
|
||||
}
|
||||
friend bool operator< (const CDRarityTable& c1, const CDRarityTable& c2) {
|
||||
return c1.rarity < c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator<= (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity <= c2.rarity;
|
||||
}
|
||||
friend bool operator<= (const CDRarityTable& c1, const CDRarityTable& c2) {
|
||||
return c1.rarity <= c2.rarity;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! RarityTable table
|
||||
class CDRarityTableTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDRarityTable> entries;
|
||||
std::vector<CDRarityTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDRarityTableTable(void);
|
||||
//! Constructor
|
||||
CDRarityTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDRarityTableTable(void);
|
||||
//! Destructor
|
||||
~CDRarityTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
//! 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<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
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;
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDRarityTable>& GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -2,62 +2,62 @@
|
||||
|
||||
//! Constructor
|
||||
CDRebuildComponentTable::CDRebuildComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RebuildComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RebuildComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDRebuildComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.reset_time = tableData.getFloatField(1, -1.0f);
|
||||
entry.complete_time = tableData.getFloatField(2, -1.0f);
|
||||
entry.take_imagination = tableData.getIntField(3, -1);
|
||||
entry.interruptible = tableData.getIntField(4, -1) == 1 ? true : false;
|
||||
entry.self_activator = tableData.getIntField(5, -1) == 1 ? true : false;
|
||||
entry.custom_modules = tableData.getStringField(6, "");
|
||||
entry.activityID = tableData.getIntField(7, -1);
|
||||
entry.post_imagination_cost = tableData.getIntField(8, -1);
|
||||
entry.time_before_smash = tableData.getFloatField(9, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RebuildComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDRebuildComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.reset_time = tableData.getFloatField(1, -1.0f);
|
||||
entry.complete_time = tableData.getFloatField(2, -1.0f);
|
||||
entry.take_imagination = tableData.getIntField(3, -1);
|
||||
entry.interruptible = tableData.getIntField(4, -1) == 1 ? true : false;
|
||||
entry.self_activator = tableData.getIntField(5, -1) == 1 ? true : false;
|
||||
entry.custom_modules = tableData.getStringField(6, "");
|
||||
entry.activityID = tableData.getIntField(7, -1);
|
||||
entry.post_imagination_cost = tableData.getIntField(8, -1);
|
||||
entry.time_before_smash = tableData.getFloatField(9, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDRebuildComponentTable::~CDRebuildComponentTable(void) { }
|
||||
CDRebuildComponentTable::~CDRebuildComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDRebuildComponentTable::GetName(void) const {
|
||||
return "RebuildComponent";
|
||||
return "RebuildComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) {
|
||||
|
||||
std::vector<CDRebuildComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
|
||||
std::vector<CDRebuildComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDRebuildComponent> CDRebuildComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -8,50 +8,50 @@
|
||||
\brief Contains data for the RebuildComponent table
|
||||
*/
|
||||
|
||||
//! RebuildComponent Struct
|
||||
//! RebuildComponent Struct
|
||||
struct CDRebuildComponent {
|
||||
unsigned int id; //!< The component Id
|
||||
float reset_time; //!< The reset time
|
||||
float complete_time; //!< The complete time
|
||||
unsigned int 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
|
||||
unsigned int activityID; //!< The activity ID
|
||||
unsigned int post_imagination_cost; //!< The post imagination cost
|
||||
float time_before_smash; //!< The time before smash
|
||||
unsigned int id; //!< The component Id
|
||||
float reset_time; //!< The reset time
|
||||
float complete_time; //!< The complete time
|
||||
unsigned int 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
|
||||
unsigned int activityID; //!< The activity ID
|
||||
unsigned int post_imagination_cost; //!< The post imagination cost
|
||||
float time_before_smash; //!< The time before smash
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDRebuildComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDRebuildComponent> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
||||
|
@@ -1,10 +1,10 @@
|
||||
#include "CDRewardsTable.h"
|
||||
|
||||
CDRewardsTable::CDRewardsTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
||||
while (!tableData.eof()) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
||||
while (!tableData.eof()) {
|
||||
CDRewards* entry = new CDRewards();
|
||||
entry->id = tableData.getIntField(0, -1);
|
||||
entry->id = tableData.getIntField(0, -1);
|
||||
entry->levelID = tableData.getIntField(1, -1);
|
||||
entry->missionID = tableData.getIntField(2, -1);
|
||||
entry->rewardType = tableData.getIntField(3, -1);
|
||||
@@ -12,29 +12,29 @@ CDRewardsTable::CDRewardsTable(void) {
|
||||
entry->count = tableData.getIntField(5, -1);
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDRewardsTable::~CDRewardsTable(void) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
m_entries.clear();
|
||||
}
|
||||
|
||||
std::string CDRewardsTable::GetName(void) const {
|
||||
return "Rewards";
|
||||
return "Rewards";
|
||||
}
|
||||
|
||||
std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
||||
std::vector<CDRewards*> result {};
|
||||
for (const auto& e : m_entries) {
|
||||
std::vector<CDRewards*> result{};
|
||||
for (const auto& e : m_entries) {
|
||||
if (e.second->levelID == levelID) result.push_back(e.second);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@@ -13,12 +13,12 @@ struct CDRewards {
|
||||
|
||||
class CDRewardsTable : public CDTable {
|
||||
public:
|
||||
CDRewardsTable(void);
|
||||
~CDRewardsTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
CDRewardsTable(void);
|
||||
~CDRewardsTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
|
||||
|
||||
private:
|
||||
std::map<uint32_t, CDRewards*> m_entries;
|
||||
};
|
||||
};
|
||||
|
@@ -2,39 +2,39 @@
|
||||
|
||||
//! Constructor
|
||||
CDScriptComponentTable::CDScriptComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ScriptComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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");
|
||||
while (!tableData.eof()) {
|
||||
CDScriptComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.script_name = tableData.getStringField(1, "");
|
||||
entry.client_script_name = tableData.getStringField(2, "");
|
||||
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ScriptComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDScriptComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.script_name = tableData.getStringField(1, "");
|
||||
entry.client_script_name = tableData.getStringField(2, "");
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDScriptComponentTable::~CDScriptComponentTable(void) { }
|
||||
CDScriptComponentTable::~CDScriptComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDScriptComponentTable::GetName(void) const {
|
||||
return "ScriptComponent";
|
||||
return "ScriptComponent";
|
||||
}
|
||||
|
||||
const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
|
||||
@@ -44,4 +44,4 @@ const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
|
||||
}
|
||||
|
||||
return m_ToReturnWhenNoneFound;
|
||||
}
|
||||
}
|
||||
|
@@ -8,39 +8,39 @@
|
||||
\brief Contains data for the ScriptComponent table
|
||||
*/
|
||||
|
||||
//! ScriptComponent Struct
|
||||
//! 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
|
||||
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 {
|
||||
private:
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
CDScriptComponent m_ToReturnWhenNoneFound;
|
||||
|
||||
|
||||
public:
|
||||
//! Gets an entry by ID
|
||||
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
|
||||
*/
|
||||
|
||||
|
||||
//! 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
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
@@ -3,82 +3,82 @@
|
||||
|
||||
//! Constructor
|
||||
CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
|
||||
m_empty = CDSkillBehavior();
|
||||
m_empty = CDSkillBehavior();
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM SkillBehavior");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM SkillBehavior");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM SkillBehavior");
|
||||
while (!tableData.eof()) {
|
||||
CDSkillBehavior entry;
|
||||
entry.skillID = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.behaviorID = tableData.getIntField(2, -1);
|
||||
entry.imaginationcost = tableData.getIntField(3, -1);
|
||||
entry.cooldowngroup = tableData.getIntField(4, -1);
|
||||
entry.cooldown = tableData.getFloatField(5, -1.0f);
|
||||
UNUSED(entry.isNpcEditor = tableData.getIntField(6, -1) == 1 ? true : false);
|
||||
UNUSED(entry.skillIcon = tableData.getIntField(7, -1));
|
||||
UNUSED(entry.oomSkillID = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField(9, -1));
|
||||
UNUSED(entry.castTypeDesc = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.imBonusUI = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.lifeBonusUI = tableData.getIntField(12, -1));
|
||||
UNUSED(entry.armorBonusUI = tableData.getIntField(13, -1));
|
||||
UNUSED(entry.damageUI = tableData.getIntField(14, -1));
|
||||
UNUSED(entry.hideIcon = tableData.getIntField(15, -1) == 1 ? true : false);
|
||||
UNUSED(entry.localize = tableData.getIntField(16, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(17, ""));
|
||||
UNUSED(entry.cancelType = tableData.getIntField(18, -1));
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM SkillBehavior");
|
||||
while (!tableData.eof()) {
|
||||
CDSkillBehavior entry;
|
||||
entry.skillID = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.behaviorID = tableData.getIntField(2, -1);
|
||||
entry.imaginationcost = tableData.getIntField(3, -1);
|
||||
entry.cooldowngroup = tableData.getIntField(4, -1);
|
||||
entry.cooldown = tableData.getFloatField(5, -1.0f);
|
||||
UNUSED(entry.isNpcEditor = tableData.getIntField(6, -1) == 1 ? true : false);
|
||||
UNUSED(entry.skillIcon = tableData.getIntField(7, -1));
|
||||
UNUSED(entry.oomSkillID = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField(9, -1));
|
||||
UNUSED(entry.castTypeDesc = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.imBonusUI = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.lifeBonusUI = tableData.getIntField(12, -1));
|
||||
UNUSED(entry.armorBonusUI = tableData.getIntField(13, -1));
|
||||
UNUSED(entry.damageUI = tableData.getIntField(14, -1));
|
||||
UNUSED(entry.hideIcon = tableData.getIntField(15, -1) == 1 ? true : false);
|
||||
UNUSED(entry.localize = tableData.getIntField(16, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(17, ""));
|
||||
UNUSED(entry.cancelType = tableData.getIntField(18, -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDSkillBehaviorTable::~CDSkillBehaviorTable(void) { }
|
||||
CDSkillBehaviorTable::~CDSkillBehaviorTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDSkillBehaviorTable::GetName(void) const {
|
||||
return "SkillBehavior";
|
||||
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();
|
||||
/*std::vector<CDSkillBehavior> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;*/
|
||||
return data;*/
|
||||
|
||||
//Logger::LogDebug("CDSkillBehaviorTable", "The 'Query' function is no longer working! Please use GetSkillByID instead!");
|
||||
//Logger::LogDebug("CDSkillBehaviorTable", "The 'Query' function is no longer working! Please use GetSkillByID instead!");
|
||||
std::vector<CDSkillBehavior> data; //So MSVC shuts up
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDSkillBehavior& CDSkillBehaviorTable::GetSkillByID(unsigned int skillID) {
|
||||
std::map<unsigned int, CDSkillBehavior>::iterator it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
std::map<unsigned int, CDSkillBehavior>::iterator it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return m_empty;
|
||||
return m_empty;
|
||||
}
|
||||
|
@@ -8,56 +8,56 @@
|
||||
\brief Contains data for the SkillBehavior table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
//! ZoneTable Struct
|
||||
struct CDSkillBehavior {
|
||||
unsigned int skillID; //!< The Skill ID of the skill
|
||||
UNUSED(unsigned int locStatus); //!< ??
|
||||
unsigned int behaviorID; //!< The Behavior ID of the skill
|
||||
unsigned int imaginationcost; //!< The imagination cost of the skill
|
||||
unsigned int cooldowngroup; //!< The cooldown group ID of the skill
|
||||
float cooldown; //!< The cooldown time of the skill
|
||||
UNUSED(bool isNpcEditor); //!< ???
|
||||
UNUSED(unsigned int skillIcon); //!< The Skill Icon ID
|
||||
UNUSED(std::string oomSkillID); //!< ???
|
||||
UNUSED(unsigned int oomBehaviorEffectID); //!< ???
|
||||
UNUSED(unsigned int castTypeDesc); //!< The cast type description(?)
|
||||
UNUSED(unsigned int imBonusUI); //!< The imagination bonus of the skill
|
||||
UNUSED(nsigned int lifeBonusUI); //!< The life bonus of the skill
|
||||
UNUSED(unsigned int armorBonusUI); //!< The armor bonus of the skill
|
||||
UNUSED(unsigned int damageUI); //!< ???
|
||||
UNUSED(bool hideIcon); //!< Whether or not to show the icon
|
||||
UNUSED(bool localize); //!< ???
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
UNUSED(unsigned int cancelType); //!< The cancel type (?)
|
||||
unsigned int skillID; //!< The Skill ID of the skill
|
||||
UNUSED(unsigned int locStatus); //!< ??
|
||||
unsigned int behaviorID; //!< The Behavior ID of the skill
|
||||
unsigned int imaginationcost; //!< The imagination cost of the skill
|
||||
unsigned int cooldowngroup; //!< The cooldown group ID of the skill
|
||||
float cooldown; //!< The cooldown time of the skill
|
||||
UNUSED(bool isNpcEditor); //!< ???
|
||||
UNUSED(unsigned int skillIcon); //!< The Skill Icon ID
|
||||
UNUSED(std::string oomSkillID); //!< ???
|
||||
UNUSED(unsigned int oomBehaviorEffectID); //!< ???
|
||||
UNUSED(unsigned int castTypeDesc); //!< The cast type description(?)
|
||||
UNUSED(unsigned int imBonusUI); //!< The imagination bonus of the skill
|
||||
UNUSED(nsigned int lifeBonusUI); //!< The life bonus of the skill
|
||||
UNUSED(unsigned int armorBonusUI); //!< The armor bonus of the skill
|
||||
UNUSED(unsigned int damageUI); //!< ???
|
||||
UNUSED(bool hideIcon); //!< Whether or not to show the icon
|
||||
UNUSED(bool localize); //!< ???
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
UNUSED(unsigned int cancelType); //!< The cancel type (?)
|
||||
};
|
||||
|
||||
//! SkillBehavior table
|
||||
class CDSkillBehaviorTable : public CDTable {
|
||||
private:
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDSkillBehaviorTable(void);
|
||||
//! Constructor
|
||||
CDSkillBehaviorTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDSkillBehaviorTable(void);
|
||||
//! Destructor
|
||||
~CDSkillBehaviorTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
//! 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<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
|
||||
//! Gets an entry by ID
|
||||
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,7 @@
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
// windows.h has min and max macros that breaks cpplinq
|
||||
#endif
|
||||
#endif
|
||||
#include "cpplinq.hpp"
|
||||
|
||||
#pragma warning (disable : 4244) //Disable double to float conversion warnings
|
||||
@@ -29,13 +29,13 @@ typedef __int64_t __int64;
|
||||
\brief A virtual class for CDClient Tables
|
||||
*/
|
||||
|
||||
//! The base class for all CD 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;
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
virtual std::string GetName() const = 0;
|
||||
};
|
||||
|
@@ -11,9 +11,9 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
@@ -35,7 +35,7 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDVendorComponentTable::~CDVendorComponentTable(void) { }
|
||||
CDVendorComponentTable::~CDVendorComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDVendorComponentTable::GetName(void) const {
|
||||
|
@@ -2,73 +2,72 @@
|
||||
|
||||
//! Constructor
|
||||
CDZoneTableTable::CDZoneTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ZoneTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int 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");
|
||||
while (!tableData.eof()) {
|
||||
CDZoneTable entry;
|
||||
entry.zoneID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.zoneName = tableData.getStringField(2, "");
|
||||
entry.scriptID = tableData.getIntField(3, -1);
|
||||
entry.ghostdistance_min = tableData.getFloatField(4, -1.0f);
|
||||
entry.ghostdistance = tableData.getFloatField(5, -1.0f);
|
||||
entry.population_soft_cap = tableData.getIntField(6, -1);
|
||||
entry.population_hard_cap = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.DisplayDescription = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.mapFolder = tableData.getStringField(9, ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField(10, -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField(11, -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField(13, ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField(14, ""));
|
||||
entry.zoneControlTemplate = tableData.getIntField(15, -1);
|
||||
entry.widthInChunks = tableData.getIntField(16, -1);
|
||||
entry.heightInChunks = tableData.getIntField(17, -1);
|
||||
entry.petsAllowed = tableData.getIntField(18, -1) == 1 ? true : false;
|
||||
entry.localize = tableData.getIntField(19, -1) == 1 ? true : false;
|
||||
entry.fZoneWeight = tableData.getFloatField(20, -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField(21, ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField(22, -1) == 1 ? true : false;
|
||||
UNUSED(entry.disableSaveLoc = tableData.getIntField(23, -1) == 1 ? true : false);
|
||||
entry.teamRadius = tableData.getFloatField(24, -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(25, ""));
|
||||
UNUSED(entry.mountsAllowed = tableData.getIntField(26, -1) == 1 ? true : false);
|
||||
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ZoneTable");
|
||||
while (!tableData.eof()) {
|
||||
CDZoneTable entry;
|
||||
entry.zoneID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.zoneName = tableData.getStringField(2, "");
|
||||
entry.scriptID = tableData.getIntField(3, -1);
|
||||
entry.ghostdistance_min = tableData.getFloatField(4, -1.0f);
|
||||
entry.ghostdistance = tableData.getFloatField(5, -1.0f);
|
||||
entry.population_soft_cap = tableData.getIntField(6, -1);
|
||||
entry.population_hard_cap = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.DisplayDescription = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.mapFolder = tableData.getStringField(9, ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField(10, -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField(11, -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField(13, ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField(14, ""));
|
||||
entry.zoneControlTemplate = tableData.getIntField(15, -1);
|
||||
entry.widthInChunks = tableData.getIntField(16, -1);
|
||||
entry.heightInChunks = tableData.getIntField(17, -1);
|
||||
entry.petsAllowed = tableData.getIntField(18, -1) == 1 ? true : false;
|
||||
entry.localize = tableData.getIntField(19, -1) == 1 ? true : false;
|
||||
entry.fZoneWeight = tableData.getFloatField(20, -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField(21, ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField(22, -1) == 1 ? true : false;
|
||||
UNUSED(entry.disableSaveLoc = tableData.getIntField(23, -1) == 1 ? true : false);
|
||||
entry.teamRadius = tableData.getFloatField(24, -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(25, ""));
|
||||
UNUSED(entry.mountsAllowed = tableData.getIntField(26, -1) == 1 ? true : false);
|
||||
|
||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDZoneTableTable::~CDZoneTableTable(void) { }
|
||||
CDZoneTableTable::~CDZoneTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDZoneTableTable::GetName(void) const {
|
||||
return "ZoneTable";
|
||||
return "ZoneTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a zoneID to find.
|
||||
const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
|
||||
const auto& iter = m_Entries.find(zoneID);
|
||||
const auto& iter = m_Entries.find(zoneID);
|
||||
|
||||
if (iter != m_Entries.end())
|
||||
{
|
||||
return &iter->second;
|
||||
}
|
||||
if (iter != m_Entries.end()) {
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@@ -8,59 +8,59 @@
|
||||
\brief Contains data for the ZoneTable table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
//! ZoneTable Struct
|
||||
struct CDZoneTable {
|
||||
unsigned int zoneID; //!< The Zone ID of the object
|
||||
unsigned int locStatus; //!< The Locale Status(?)
|
||||
std::string zoneName; //!< The name of the zone
|
||||
unsigned int scriptID; //!< The Script ID of the zone (ScriptsTable)
|
||||
float ghostdistance_min; //!< The minimum ghosting distance
|
||||
float ghostdistance; //!< The ghosting distance
|
||||
unsigned int population_soft_cap; //!< The "soft cap" on the world population
|
||||
unsigned int 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
|
||||
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
|
||||
unsigned int zoneControlTemplate; //!< The Zone Control template
|
||||
unsigned int widthInChunks; //!< The width of the world in chunks
|
||||
unsigned int heightInChunks; //!< The height of the world in chunks
|
||||
bool petsAllowed; //!< Whether or not pets are allowed in the world
|
||||
unsigned int zoneID; //!< The Zone ID of the object
|
||||
unsigned int locStatus; //!< The Locale Status(?)
|
||||
std::string zoneName; //!< The name of the zone
|
||||
unsigned int scriptID; //!< The Script ID of the zone (ScriptsTable)
|
||||
float ghostdistance_min; //!< The minimum ghosting distance
|
||||
float ghostdistance; //!< The ghosting distance
|
||||
unsigned int population_soft_cap; //!< The "soft cap" on the world population
|
||||
unsigned int 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
|
||||
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
|
||||
unsigned int zoneControlTemplate; //!< The Zone Control template
|
||||
unsigned int widthInChunks; //!< The width of the world in chunks
|
||||
unsigned int 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
|
||||
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
|
||||
float fZoneWeight; //!< ???
|
||||
UNUSED(std::string thumbnail); //!< The thumbnail of the world
|
||||
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
|
||||
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
|
||||
float teamRadius; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
//! ZoneTable table
|
||||
class CDZoneTableTable : public CDTable {
|
||||
private:
|
||||
std::map<unsigned int, CDZoneTable> m_Entries;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//! 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
|
||||
*/
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
};
|
||||
|
||||
//! 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
|
||||
*/
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
};
|
||||
|
Reference in New Issue
Block a user