mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-09-26 07:53:48 +00:00
Merge branch 'main' into cdclient-rework
This commit is contained in:
@@ -14,6 +14,11 @@ CppSQLite3Query CDClientDatabase::ExecuteQuery(const std::string& query) {
|
||||
return conn->execQuery(query.c_str());
|
||||
}
|
||||
|
||||
//! Updates the CDClient file with Data Manipulation Language (DML) commands.
|
||||
int CDClientDatabase::ExecuteDML(const std::string& query) {
|
||||
return conn->execDML(query.c_str());
|
||||
}
|
||||
|
||||
//! Makes prepared statements
|
||||
CppSQLite3Statement CDClientDatabase::CreatePreppedStmt(const std::string& query) {
|
||||
return conn->compileStatement(query.c_str());
|
||||
|
||||
@@ -16,9 +16,6 @@
|
||||
// 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
|
||||
#define UNUSED(v)
|
||||
|
||||
/*!
|
||||
\file CDClientDatabase.hpp
|
||||
\brief An interface between the CDClient.sqlite file and the server
|
||||
@@ -40,6 +37,14 @@ namespace CDClientDatabase {
|
||||
*/
|
||||
CppSQLite3Query ExecuteQuery(const std::string& query);
|
||||
|
||||
//! Updates the CDClient file with Data Manipulation Language (DML) commands.
|
||||
/*!
|
||||
\param query The DML command to run. DML command can be multiple queries in one string but only
|
||||
the last one will return its number of updated rows.
|
||||
\return The number of updated rows.
|
||||
*/
|
||||
int ExecuteDML(const std::string& query);
|
||||
|
||||
//! Queries the CDClient and parses arguments
|
||||
/*!
|
||||
\param query The query with formatted arguments
|
||||
|
||||
@@ -1,50 +1,82 @@
|
||||
#include "CDClientManager.h"
|
||||
#include "CDActivityRewardsTable.h"
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
#include "CDEmoteTable.h"
|
||||
#include "CDInventoryComponentTable.h"
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "CDItemSetsTable.h"
|
||||
#include "CDItemSetSkillsTable.h"
|
||||
#include "CDLevelProgressionLookupTable.h"
|
||||
#include "CDLootMatrixTable.h"
|
||||
#include "CDLootTableTable.h"
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
#include "CDMissionTasksTable.h"
|
||||
#include "CDMissionsTable.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "CDObjectsTable.h"
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
#include "CDRebuildComponentTable.h"
|
||||
#include "CDScriptComponentTable.h"
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "CDVendorComponentTable.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
#include "CDPackageComponentTable.h"
|
||||
#include "CDProximityMonitorComponentTable.h"
|
||||
#include "CDMovementAIComponentTable.h"
|
||||
#include "CDBrickIDTableTable.h"
|
||||
#include "CDRarityTableTable.h"
|
||||
#include "CDMissionEmailTable.h"
|
||||
#include "CDRewardsTable.h"
|
||||
#include "CDPropertyEntranceComponentTable.h"
|
||||
#include "CDPropertyTemplateTable.h"
|
||||
#include "CDFeatureGatingTable.h"
|
||||
#include "CDRailActivatorComponent.h"
|
||||
|
||||
// Static Variables
|
||||
CDClientManager* CDClientManager::m_Address = nullptr;
|
||||
|
||||
//! Initializes the manager
|
||||
void CDClientManager::Initialize(void) {
|
||||
CDTable::Initalize();
|
||||
|
||||
tables.insert(std::make_pair("ActivityRewards", new CDActivityRewardsTable()));
|
||||
UNUSED(tables.insert(std::make_pair("Animations", new CDAnimationsTable())));
|
||||
tables.insert(std::make_pair("BehaviorParameter", new CDBehaviorParameterTable()));
|
||||
tables.insert(std::make_pair("BehaviorTemplate", new CDBehaviorTemplateTable()));
|
||||
tables.insert(std::make_pair("ComponentsRegistry", new CDComponentsRegistryTable()));
|
||||
tables.insert(std::make_pair("CurrencyTable", new CDCurrencyTableTable()));
|
||||
tables.insert(std::make_pair("DestructibleComponent", new CDDestructibleComponentTable()));
|
||||
tables.insert(std::make_pair("EmoteTable", new CDEmoteTableTable()));
|
||||
tables.insert(std::make_pair("InventoryComponent", new CDInventoryComponentTable()));
|
||||
tables.insert(std::make_pair("ItemComponent", new CDItemComponentTable()));
|
||||
tables.insert(std::make_pair("ItemSets", new CDItemSetsTable()));
|
||||
tables.insert(std::make_pair("ItemSetSkills", new CDItemSetSkillsTable()));
|
||||
tables.insert(std::make_pair("LevelProgressionLookup", new CDLevelProgressionLookupTable()));
|
||||
tables.insert(std::make_pair("LootMatrix", new CDLootMatrixTable()));
|
||||
tables.insert(std::make_pair("LootTable", new CDLootTableTable()));
|
||||
tables.insert(std::make_pair("MissionNPCComponent", new CDMissionNPCComponentTable()));
|
||||
tables.insert(std::make_pair("MissionTasks", new CDMissionTasksTable()));
|
||||
tables.insert(std::make_pair("Missions", new CDMissionsTable()));
|
||||
tables.insert(std::make_pair("ObjectSkills", new CDObjectSkillsTable()));
|
||||
tables.insert(std::make_pair("Objects", new CDObjectsTable()));
|
||||
tables.insert(std::make_pair("PhysicsComponent", new CDPhysicsComponentTable()));
|
||||
tables.insert(std::make_pair("RebuildComponent", new CDRebuildComponentTable()));
|
||||
tables.insert(std::make_pair("ScriptComponent", new CDScriptComponentTable()));
|
||||
tables.insert(std::make_pair("SkillBehavior", new CDSkillBehaviorTable()));
|
||||
tables.insert(std::make_pair("ZoneTable", new CDZoneTableTable()));
|
||||
tables.insert(std::make_pair("VendorComponent", new CDVendorComponentTable()));
|
||||
tables.insert(std::make_pair("Activities", new CDActivitiesTable()));
|
||||
tables.insert(std::make_pair("PackageComponent", new CDPackageComponentTable()));
|
||||
tables.insert(std::make_pair("ProximityMonitorComponent", new CDProximityMonitorComponentTable()));
|
||||
tables.insert(std::make_pair("MovementAIComponent", new CDMovementAIComponentTable()));
|
||||
tables.insert(std::make_pair("BrickIDTable", new CDBrickIDTableTable()));
|
||||
tables.insert(std::make_pair("RarityTable", new CDRarityTableTable()));
|
||||
tables.insert(std::make_pair("MissionEmail", new CDMissionEmailTable()));
|
||||
tables.insert(std::make_pair("Rewards", new CDRewardsTable()));
|
||||
tables.insert(std::make_pair("PropertyEntranceComponent", new CDPropertyEntranceComponentTable()));
|
||||
tables.insert(std::make_pair("PropertyTemplate", new CDPropertyTemplateTable()));
|
||||
tables.insert(std::make_pair("FeatureGating", new CDFeatureGatingTable()));
|
||||
tables.insert(std::make_pair("RailActivatorComponent", new CDRailActivatorComponentTable()));
|
||||
CDClientManager::CDClientManager() {
|
||||
CDActivityRewardsTable::Instance();
|
||||
CDAnimationsTable::Instance();
|
||||
CDBehaviorParameterTable::Instance();
|
||||
CDBehaviorTemplateTable::Instance();
|
||||
CDComponentsRegistryTable::Instance();
|
||||
CDCurrencyTableTable::Instance();
|
||||
CDDestructibleComponentTable::Instance();
|
||||
CDEmoteTableTable::Instance();
|
||||
CDInventoryComponentTable::Instance();
|
||||
CDItemComponentTable::Instance();
|
||||
CDItemSetsTable::Instance();
|
||||
CDItemSetSkillsTable::Instance();
|
||||
CDLevelProgressionLookupTable::Instance();
|
||||
CDLootMatrixTable::Instance();
|
||||
CDLootTableTable::Instance();
|
||||
CDMissionNPCComponentTable::Instance();
|
||||
CDMissionTasksTable::Instance();
|
||||
CDMissionsTable::Instance();
|
||||
CDObjectSkillsTable::Instance();
|
||||
CDObjectsTable::Instance();
|
||||
CDPhysicsComponentTable::Instance();
|
||||
CDRebuildComponentTable::Instance();
|
||||
CDScriptComponentTable::Instance();
|
||||
CDSkillBehaviorTable::Instance();
|
||||
CDZoneTableTable::Instance();
|
||||
CDVendorComponentTable::Instance();
|
||||
CDActivitiesTable::Instance();
|
||||
CDPackageComponentTable::Instance();
|
||||
CDProximityMonitorComponentTable::Instance();
|
||||
CDMovementAIComponentTable::Instance();
|
||||
CDBrickIDTableTable::Instance();
|
||||
CDRarityTableTable::Instance();
|
||||
CDMissionEmailTable::Instance();
|
||||
CDRewardsTable::Instance();
|
||||
CDPropertyEntranceComponentTable::Instance();
|
||||
CDPropertyTemplateTable::Instance();
|
||||
CDFeatureGatingTable::Instance();
|
||||
CDRailActivatorComponentTable::Instance();
|
||||
}
|
||||
|
||||
void CDClientManager::LoadHost() {
|
||||
|
||||
@@ -1,96 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
// Tables
|
||||
#include "CDActivityRewardsTable.h"
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
#include "CDEmoteTable.h"
|
||||
#include "CDInventoryComponentTable.h"
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "CDItemSetsTable.h"
|
||||
#include "CDItemSetSkillsTable.h"
|
||||
#include "CDLevelProgressionLookupTable.h"
|
||||
#include "CDLootMatrixTable.h"
|
||||
#include "CDLootTableTable.h"
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
#include "CDMissionTasksTable.h"
|
||||
#include "CDMissionsTable.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "CDObjectsTable.h"
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
#include "CDRebuildComponentTable.h"
|
||||
#include "CDScriptComponentTable.h"
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "CDVendorComponentTable.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
#include "CDPackageComponentTable.h"
|
||||
#include "CDProximityMonitorComponentTable.h"
|
||||
#include "CDMovementAIComponentTable.h"
|
||||
#include "CDBrickIDTableTable.h"
|
||||
#include "CDRarityTableTable.h"
|
||||
#include "CDMissionEmailTable.h"
|
||||
#include "CDRewardsTable.h"
|
||||
#include "CDPropertyEntranceComponentTable.h"
|
||||
#include "CDPropertyTemplateTable.h"
|
||||
#include "CDFeatureGatingTable.h"
|
||||
#include "CDRailActivatorComponent.h"
|
||||
#include "Singleton.h"
|
||||
|
||||
// C++
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#define UNUSED_TABLE(v)
|
||||
|
||||
/*!
|
||||
\file CDClientManager.hpp
|
||||
\brief A manager for the CDClient tables
|
||||
/**
|
||||
* Initialize the CDClient tables so they are all loaded into memory.
|
||||
*/
|
||||
|
||||
//! 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
|
||||
|
||||
class CDClientManager : public Singleton<CDClientManager> {
|
||||
public:
|
||||
CDClientManager();
|
||||
|
||||
//! 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
|
||||
/**
|
||||
* Fetch a table from CDClient
|
||||
*
|
||||
* @tparam Table type to fetch
|
||||
* @return A pointer to the requested table.
|
||||
*/
|
||||
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;
|
||||
T* GetTable() {
|
||||
return &T::Instance();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -14,8 +14,6 @@ std::string Database::database;
|
||||
void Database::Connect(const string& host, const string& database, const string& username, const string& password) {
|
||||
|
||||
//To bypass debug issues:
|
||||
std::string newHost = "tcp://" + host;
|
||||
const char* szHost = newHost.c_str();
|
||||
const char* szDatabase = database.c_str();
|
||||
const char* szUsername = username.c_str();
|
||||
const char* szPassword = password.c_str();
|
||||
@@ -23,7 +21,24 @@ void Database::Connect(const string& host, const string& database, const string&
|
||||
driver = sql::mariadb::get_driver_instance();
|
||||
|
||||
sql::Properties properties;
|
||||
properties["hostName"] = szHost;
|
||||
// The mariadb connector is *supposed* to handle unix:// and pipe:// prefixes to hostName, but there are bugs where
|
||||
// 1) it tries to parse a database from the connection string (like in tcp://localhost:3001/darkflame) based on the
|
||||
// presence of a /
|
||||
// 2) even avoiding that, the connector still assumes you're connecting with a tcp socket
|
||||
// So, what we do in the presence of a unix socket or pipe is to set the hostname to the protocol and localhost,
|
||||
// which avoids parsing errors while still ensuring the correct connection type is used, and then setting the appropriate
|
||||
// property manually (which the URL parsing fails to do)
|
||||
const std::string UNIX_PROTO = "unix://";
|
||||
const std::string PIPE_PROTO = "pipe://";
|
||||
if (host.find(UNIX_PROTO) == 0) {
|
||||
properties["hostName"] = "unix://localhost";
|
||||
properties["localSocket"] = host.substr(UNIX_PROTO.length()).c_str();
|
||||
} else if (host.find(PIPE_PROTO) == 0) {
|
||||
properties["hostName"] = "pipe://localhost";
|
||||
properties["pipe"] = host.substr(PIPE_PROTO.length()).c_str();
|
||||
} else {
|
||||
properties["hostName"] = host.c_str();
|
||||
}
|
||||
properties["user"] = szUsername;
|
||||
properties["password"] = szPassword;
|
||||
properties["autoReconnect"] = "true";
|
||||
@@ -35,8 +50,14 @@ void Database::Connect(const string& host, const string& database, const string&
|
||||
}
|
||||
|
||||
void Database::Connect() {
|
||||
con = driver->connect(Database::props);
|
||||
con->setSchema(Database::database);
|
||||
// `connect(const Properties& props)` segfaults in windows debug, but
|
||||
// `connect(const SQLString& host, const SQLString& user, const SQLString& pwd)` doesn't handle pipes/unix sockets correctly
|
||||
if (Database::props.find("localSocket") != Database::props.end() || Database::props.find("pipe") != Database::props.end()) {
|
||||
con = driver->connect(Database::props);
|
||||
} else {
|
||||
con = driver->connect(Database::props["hostName"].c_str(), Database::props["user"].c_str(), Database::props["password"].c_str());
|
||||
}
|
||||
con->setSchema(Database::database.c_str());
|
||||
}
|
||||
|
||||
void Database::Destroy(std::string source, bool log) {
|
||||
|
||||
@@ -1,80 +1,18 @@
|
||||
#include "MigrationRunner.h"
|
||||
|
||||
#include "BrickByBrickFix.h"
|
||||
#include "CDClientDatabase.h"
|
||||
#include "Database.h"
|
||||
#include "Game.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "dLogger.h"
|
||||
#include "BinaryPathFinder.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <algorithm>
|
||||
#include <thread>
|
||||
#include <istream>
|
||||
|
||||
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->execute();
|
||||
delete stmt;
|
||||
|
||||
sql::SQLString finalSQL = "";
|
||||
Migration checkMigration{};
|
||||
bool runSd0Migrations = false;
|
||||
for (const auto& entry : GeneralUtils::GetFileNamesFromFolder("./migrations/")) {
|
||||
auto migration = LoadMigration(entry);
|
||||
|
||||
if (migration.data.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
Game::logger->Log("MigrationRunner", "Running migration: %s", migration.name.c_str());
|
||||
if (migration.name == "5_brick_model_sd0.sql") {
|
||||
runSd0Migrations = true;
|
||||
} else {
|
||||
finalSQL.append(migration.data);
|
||||
}
|
||||
|
||||
stmt = Database::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
stmt->setString(1, entry);
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
}
|
||||
|
||||
if (finalSQL.empty() && !runSd0Migrations) {
|
||||
Game::logger->Log("MigrationRunner", "Server database is up to date.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!finalSQL.empty()) {
|
||||
auto migration = GeneralUtils::SplitString(static_cast<std::string>(finalSQL), ';');
|
||||
std::unique_ptr<sql::Statement> simpleStatement(Database::CreateStmt());
|
||||
for (auto& query : migration) {
|
||||
try {
|
||||
if (query.empty()) continue;
|
||||
simpleStatement->execute(query);
|
||||
} catch (sql::SQLException& e) {
|
||||
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do this last on the off chance none of the other migrations have been run yet.
|
||||
if (runSd0Migrations) {
|
||||
uint32_t numberOfUpdatedModels = BrickByBrickFix::UpdateBrickByBrickModelsToSd0();
|
||||
Game::logger->Log("MasterServer", "%i models were updated from zlib to sd0.", numberOfUpdatedModels);
|
||||
uint32_t numberOfTruncatedModels = BrickByBrickFix::TruncateBrokenBrickByBrickXml();
|
||||
Game::logger->Log("MasterServer", "%i models were truncated from the database.", numberOfTruncatedModels);
|
||||
}
|
||||
}
|
||||
|
||||
Migration MigrationRunner::LoadMigration(std::string path) {
|
||||
Migration LoadMigration(std::string path) {
|
||||
Migration migration{};
|
||||
std::ifstream file("./migrations/" + path);
|
||||
std::ifstream file(BinaryPathFinder::GetBinaryDir() / "migrations/" / path);
|
||||
|
||||
if (file.is_open()) {
|
||||
std::string line;
|
||||
@@ -92,3 +30,129 @@ Migration MigrationRunner::LoadMigration(std::string path) {
|
||||
|
||||
return migration;
|
||||
}
|
||||
|
||||
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->execute();
|
||||
delete stmt;
|
||||
|
||||
sql::SQLString finalSQL = "";
|
||||
bool runSd0Migrations = false;
|
||||
for (const auto& entry : GeneralUtils::GetSqlFileNamesFromFolder((BinaryPathFinder::GetBinaryDir() / "./migrations/dlu/").string())) {
|
||||
auto migration = LoadMigration("dlu/" + entry);
|
||||
|
||||
if (migration.data.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
|
||||
stmt->setString(1, migration.name.c_str());
|
||||
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());
|
||||
if (migration.name == "dlu/5_brick_model_sd0.sql") {
|
||||
runSd0Migrations = true;
|
||||
} else {
|
||||
finalSQL.append(migration.data.c_str());
|
||||
}
|
||||
|
||||
stmt = Database::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
stmt->setString(1, migration.name.c_str());
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
}
|
||||
|
||||
if (finalSQL.empty() && !runSd0Migrations) {
|
||||
Game::logger->Log("MigrationRunner", "Server database is up to date.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!finalSQL.empty()) {
|
||||
auto migration = GeneralUtils::SplitString(static_cast<std::string>(finalSQL), ';');
|
||||
std::unique_ptr<sql::Statement> simpleStatement(Database::CreateStmt());
|
||||
for (auto& query : migration) {
|
||||
try {
|
||||
if (query.empty()) continue;
|
||||
simpleStatement->execute(query.c_str());
|
||||
} catch (sql::SQLException& e) {
|
||||
Game::logger->Log("MigrationRunner", "Encountered error running migration: %s", e.what());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Do this last on the off chance none of the other migrations have been run yet.
|
||||
if (runSd0Migrations) {
|
||||
uint32_t numberOfUpdatedModels = BrickByBrickFix::UpdateBrickByBrickModelsToSd0();
|
||||
Game::logger->Log("MasterServer", "%i models were updated from zlib to sd0.", numberOfUpdatedModels);
|
||||
uint32_t numberOfTruncatedModels = BrickByBrickFix::TruncateBrokenBrickByBrickXml();
|
||||
Game::logger->Log("MasterServer", "%i models were truncated from the database.", numberOfTruncatedModels);
|
||||
}
|
||||
}
|
||||
|
||||
void MigrationRunner::RunSQLiteMigrations() {
|
||||
auto cdstmt = CDClientDatabase::CreatePreppedStmt("CREATE TABLE IF NOT EXISTS migration_history (name TEXT NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP);");
|
||||
cdstmt.execQuery().finalize();
|
||||
cdstmt.finalize();
|
||||
|
||||
auto* stmt = Database::CreatePreppedStmt("CREATE TABLE IF NOT EXISTS migration_history (name TEXT NOT NULL, date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP());");
|
||||
stmt->execute();
|
||||
delete stmt;
|
||||
|
||||
for (const auto& entry : GeneralUtils::GetSqlFileNamesFromFolder((BinaryPathFinder::GetBinaryDir() / "migrations/cdserver/").string())) {
|
||||
auto migration = LoadMigration("cdserver/" + entry);
|
||||
|
||||
if (migration.data.empty()) continue;
|
||||
|
||||
// Check if there is an entry in the migration history table on the cdclient database.
|
||||
cdstmt = CDClientDatabase::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
|
||||
cdstmt.bind((int32_t) 1, migration.name.c_str());
|
||||
auto cdres = cdstmt.execQuery();
|
||||
bool doExit = !cdres.eof();
|
||||
cdres.finalize();
|
||||
cdstmt.finalize();
|
||||
|
||||
if (doExit) continue;
|
||||
|
||||
// Check first if there is entry in the migration history table on the main database.
|
||||
stmt = Database::CreatePreppedStmt("SELECT name FROM migration_history WHERE name = ?;");
|
||||
stmt->setString(1, migration.name.c_str());
|
||||
auto* res = stmt->executeQuery();
|
||||
doExit = res->next();
|
||||
delete res;
|
||||
delete stmt;
|
||||
if (doExit) {
|
||||
// Insert into cdclient database if there is an entry in the main database but not the cdclient database.
|
||||
cdstmt = CDClientDatabase::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
cdstmt.bind((int32_t) 1, migration.name.c_str());
|
||||
cdstmt.execQuery().finalize();
|
||||
cdstmt.finalize();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Doing these 1 migration at a time since one takes a long time and some may think it is crashing.
|
||||
// This will at the least guarentee that the full migration needs to be run in order to be counted as "migrated".
|
||||
Game::logger->Log("MigrationRunner", "Executing migration: %s. This may take a while. Do not shut down server.", migration.name.c_str());
|
||||
CDClientDatabase::ExecuteQuery("BEGIN TRANSACTION;");
|
||||
for (const auto& dml : GeneralUtils::SplitString(migration.data, ';')) {
|
||||
if (dml.empty()) continue;
|
||||
try {
|
||||
CDClientDatabase::ExecuteDML(dml.c_str());
|
||||
} catch (CppSQLite3Exception& e) {
|
||||
Game::logger->Log("MigrationRunner", "Encountered error running DML command: (%i) : %s", e.errorCode(), e.errorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// Insert into cdclient database.
|
||||
cdstmt = CDClientDatabase::CreatePreppedStmt("INSERT INTO migration_history (name) VALUES (?);");
|
||||
cdstmt.bind((int32_t) 1, migration.name.c_str());
|
||||
cdstmt.execQuery().finalize();
|
||||
cdstmt.finalize();
|
||||
CDClientDatabase::ExecuteQuery("COMMIT;");
|
||||
}
|
||||
|
||||
Game::logger->Log("MigrationRunner", "CDServer database is up to date.");
|
||||
}
|
||||
|
||||
@@ -1,19 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include "Database.h"
|
||||
|
||||
#include "dCommonVars.h"
|
||||
#include "Game.h"
|
||||
#include "dCommonVars.h"
|
||||
#include "dLogger.h"
|
||||
#include <string>
|
||||
|
||||
struct Migration {
|
||||
std::string data;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class MigrationRunner {
|
||||
public:
|
||||
static void RunMigrations();
|
||||
static Migration LoadMigration(std::string path);
|
||||
namespace MigrationRunner {
|
||||
void RunMigrations();
|
||||
void RunSQLiteMigrations();
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDActivitiesTable::CDActivitiesTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
@@ -21,25 +20,25 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
|
||||
while (!tableData.eof()) {
|
||||
CDActivities entry;
|
||||
entry.ActivityID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.instanceMapID = tableData.getIntField(2, -1);
|
||||
entry.minTeams = tableData.getIntField(3, -1);
|
||||
entry.maxTeams = tableData.getIntField(4, -1);
|
||||
entry.minTeamSize = tableData.getIntField(5, -1);
|
||||
entry.maxTeamSize = tableData.getIntField(6, -1);
|
||||
entry.waitTime = tableData.getIntField(7, -1);
|
||||
entry.startDelay = tableData.getIntField(8, -1);
|
||||
entry.requiresUniqueData = tableData.getIntField(9, -1);
|
||||
entry.leaderboardType = tableData.getIntField(10, -1);
|
||||
entry.localize = tableData.getIntField(11, -1);
|
||||
entry.optionalCostLOT = tableData.getIntField(12, -1);
|
||||
entry.optionalCostCount = tableData.getIntField(13, -1);
|
||||
entry.showUIRewards = tableData.getIntField(14, -1);
|
||||
entry.CommunityActivityFlagID = tableData.getIntField(15, -1);
|
||||
entry.gate_version = tableData.getStringField(16, "");
|
||||
entry.noTeamLootOnDeath = tableData.getIntField(17, -1);
|
||||
entry.optionalPercentage = tableData.getFloatField(18, -1.0f);
|
||||
entry.ActivityID = tableData.getIntField("ActivityID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
|
||||
entry.minTeams = tableData.getIntField("minTeams", -1);
|
||||
entry.maxTeams = tableData.getIntField("maxTeams", -1);
|
||||
entry.minTeamSize = tableData.getIntField("minTeamSize", -1);
|
||||
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
|
||||
entry.waitTime = tableData.getIntField("waitTime", -1);
|
||||
entry.startDelay = tableData.getIntField("startDelay", -1);
|
||||
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
|
||||
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
|
||||
entry.localize = tableData.getIntField("localize", -1);
|
||||
entry.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
|
||||
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
|
||||
entry.showUIRewards = tableData.getIntField("showUIRewards", -1);
|
||||
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
|
||||
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -48,15 +47,6 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDActivitiesTable::~CDActivitiesTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDActivitiesTable::GetName(void) const {
|
||||
return "Activities";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
|
||||
|
||||
std::vector<CDActivities> data = cpplinq::from(this->entries)
|
||||
@@ -66,7 +56,7 @@ std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActiviti
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDActivitiesTable.hpp
|
||||
\brief Contains data for the Activities table
|
||||
*/
|
||||
|
||||
//! Activities Entry Struct
|
||||
struct CDActivities {
|
||||
unsigned int ActivityID;
|
||||
unsigned int locStatus;
|
||||
@@ -31,36 +25,14 @@ struct CDActivities {
|
||||
float optionalPercentage;
|
||||
};
|
||||
|
||||
|
||||
//! Activities table
|
||||
class CDActivitiesTable : public CDTable {
|
||||
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
|
||||
private:
|
||||
std::vector<CDActivities> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDActivitiesTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDActivitiesTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDActivitiesTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDActivities> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "CDActivityRewardsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
@@ -21,13 +20,13 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
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, "");
|
||||
entry.objectTemplate = tableData.getIntField("objectTemplate", -1);
|
||||
entry.ActivityRewardIndex = tableData.getIntField("ActivityRewardIndex", -1);
|
||||
entry.activityRating = tableData.getIntField("activityRating", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
|
||||
entry.ChallengeRating = tableData.getIntField("ChallengeRating", -1);
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -36,15 +35,6 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDActivityRewardsTable::~CDActivityRewardsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDActivityRewardsTable::GetName(void) const {
|
||||
return "ActivityRewards";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
|
||||
|
||||
std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
|
||||
@@ -54,7 +44,7 @@ std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDActivityRewardsTable.hpp
|
||||
\brief Contains data for the ActivityRewards table
|
||||
*/
|
||||
|
||||
//! ActivityRewards Entry Struct
|
||||
struct CDActivityRewards {
|
||||
unsigned int objectTemplate; //!< The object template (?)
|
||||
unsigned int ActivityRewardIndex; //!< The activity reward index
|
||||
@@ -19,36 +13,15 @@ struct CDActivityRewards {
|
||||
std::string description; //!< The description
|
||||
};
|
||||
|
||||
|
||||
//! ActivityRewards table
|
||||
class CDActivityRewardsTable : public CDTable {
|
||||
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
|
||||
private:
|
||||
std::vector<CDActivityRewards> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDActivityRewardsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDActivityRewardsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDActivityRewardsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDActivityRewards> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,66 +1,83 @@
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "Game.h"
|
||||
|
||||
//! Constructor
|
||||
CDAnimationsTable::CDAnimationsTable(void) {
|
||||
bool CDAnimationsTable::CacheData(CppSQLite3Statement& queryToCache) {
|
||||
auto tableData = queryToCache.execQuery();
|
||||
// If we received a bad lookup, cache it anyways so we do not run the query again.
|
||||
if (tableData.eof()) return false;
|
||||
|
||||
// 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);
|
||||
do {
|
||||
std::string animation_type = tableData.getStringField("animation_type", "");
|
||||
DluAssert(!animation_type.empty());
|
||||
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
|
||||
DluAssert(animationGroupID != -1);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
CDAnimation entry;
|
||||
entry.animation_name = tableData.getStringField("animation_name", "");
|
||||
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
|
||||
UNUSED_COLUMN(entry.min_loops = tableData.getIntField("min_loops", 0);)
|
||||
UNUSED_COLUMN(entry.max_loops = tableData.getIntField("max_loops", 0);)
|
||||
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
|
||||
UNUSED_COLUMN(entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.restartable = tableData.getIntField("restartable", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.face_animation_name = tableData.getStringField("face_animation_name", "");)
|
||||
UNUSED_COLUMN(entry.priority = tableData.getFloatField("priority", 0.0f);)
|
||||
UNUSED_COLUMN(entry.blendTime = tableData.getFloatField("blendTime", 0.0f);)
|
||||
|
||||
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);
|
||||
this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
} while (!tableData.eof());
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDAnimationsTable::~CDAnimationsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDAnimationsTable::GetName(void) const {
|
||||
return "Animations";
|
||||
void CDAnimationsTable::CacheAnimations(const CDAnimationKey animationKey) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ? and animation_type = ?");
|
||||
query.bind(1, static_cast<int32_t>(animationKey.second));
|
||||
query.bind(2, animationKey.first.c_str());
|
||||
// If we received a bad lookup, cache it anyways so we do not run the query again.
|
||||
if (!CacheData(query)) {
|
||||
this->animations[animationKey];
|
||||
}
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
|
||||
void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
|
||||
auto animationEntryCached = this->animations.find(CDAnimationKey("", animationGroupID));
|
||||
if (animationEntryCached != this->animations.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<CDAnimations> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ?");
|
||||
query.bind(1, static_cast<int32_t>(animationGroupID));
|
||||
|
||||
return data;
|
||||
// Cache the query so we don't run the query again.
|
||||
CacheData(query);
|
||||
this->animations[CDAnimationKey("", animationGroupID)];
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
CDAnimationLookupResult CDAnimationsTable::GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID) {
|
||||
CDAnimationKey animationKey(animationType, animationGroupID);
|
||||
auto animationEntryCached = this->animations.find(animationKey);
|
||||
if (animationEntryCached == this->animations.end()) {
|
||||
this->CacheAnimations(animationKey);
|
||||
}
|
||||
|
||||
auto animationEntry = this->animations.find(animationKey);
|
||||
// If we have only one animation, return it regardless of the chance to play.
|
||||
if (animationEntry->second.size() == 1) {
|
||||
return CDAnimationLookupResult(animationEntry->second.front());
|
||||
}
|
||||
auto randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
|
||||
|
||||
for (auto& animationEntry : animationEntry->second) {
|
||||
randomAnimation -= animationEntry.chance_to_play;
|
||||
// This is how the client gets the random animation.
|
||||
if (animationEntry.animation_name != previousAnimationName && randomAnimation <= 0.0f) return CDAnimationLookupResult(animationEntry);
|
||||
}
|
||||
|
||||
return CDAnimationLookupResult();
|
||||
}
|
||||
|
||||
@@ -1,60 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <list>
|
||||
|
||||
/*!
|
||||
\file CDAnimationsTable.hpp
|
||||
\brief Contains data for the Animations table
|
||||
*/
|
||||
|
||||
//! Animations Entry Struct
|
||||
struct CDAnimations {
|
||||
unsigned int animationGroupID; //!< The animation group ID
|
||||
std::string animation_type; //!< The animation type
|
||||
struct CDAnimation {
|
||||
// unsigned int animationGroupID;
|
||||
// std::string animation_type;
|
||||
// The above two are a pair to represent a primary key in the map.
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
unsigned int min_loops; //!< The minimum number of loops
|
||||
unsigned int max_loops; //!< The maximum number of loops
|
||||
UNUSED_COLUMN(unsigned int min_loops;) //!< The minimum number of loops
|
||||
UNUSED_COLUMN(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
|
||||
UNUSED_COLUMN(bool hideEquip;) //!< Whether or not to hide the equip
|
||||
UNUSED_COLUMN(bool ignoreUpperBody;) //!< Whether or not to ignore the upper body
|
||||
UNUSED_COLUMN(bool restartable;) //!< Whether or not the animation is restartable
|
||||
UNUSED_COLUMN(std::string face_animation_name;) //!< The face animation name
|
||||
UNUSED_COLUMN(float priority;) //!< The priority
|
||||
UNUSED_COLUMN(float blendTime;) //!< The blend time
|
||||
};
|
||||
|
||||
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
|
||||
|
||||
//! Animations table
|
||||
class CDAnimationsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDAnimations> entries;
|
||||
|
||||
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
|
||||
typedef int32_t AnimationGroupID;
|
||||
typedef std::string AnimationID;
|
||||
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDAnimationsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDAnimationsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
/**
|
||||
* Given an animationType and the previousAnimationName played, return the next animationType to play.
|
||||
* If there are more than 1 animationTypes that can be played, one is selected at random but also does not allow
|
||||
* the previousAnimationName to be played twice.
|
||||
*
|
||||
* @param animationType The animationID to lookup
|
||||
* @param previousAnimationName The previously played animation
|
||||
* @param animationGroupID The animationGroupID to lookup
|
||||
* @return CDAnimationLookupResult
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
[[nodiscard]] CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
/**
|
||||
* Cache a full AnimationGroup by its ID.
|
||||
*/
|
||||
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
|
||||
void CacheAnimationGroup(AnimationGroupID animationGroupID);
|
||||
private:
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
/**
|
||||
* Cache all animations given a premade key
|
||||
*/
|
||||
std::vector<CDAnimations> GetEntries(void) const;
|
||||
void CacheAnimations(const CDAnimationKey animationKey);
|
||||
|
||||
/**
|
||||
* Run the query responsible for caching the data.
|
||||
* @param queryToCache
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool CacheData(CppSQLite3Statement& queryToCache);
|
||||
|
||||
/**
|
||||
* Each animation is key'd by its animationName and its animationGroupID. Each
|
||||
* animation has a possible list of animations. This is because there can be animations have a percent chance to play so one is selected at random.
|
||||
*/
|
||||
std::map<CDAnimationKey, std::list<CDAnimation>> animations;
|
||||
};
|
||||
|
||||
@@ -1,51 +1,53 @@
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "dServer.h"
|
||||
|
||||
#include "CDProvider.h"
|
||||
|
||||
CD_PROVIDER(BehaviorParameterProvider, size_t, float);
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
|
||||
NEW_CD_PROVIDER(BehaviorParameterProvider, "BehaviorParameter", [](CppSQLite3Query& query) {
|
||||
size_t hash = 0;
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
|
||||
uint32_t uniqueParameterId = 0;
|
||||
uint64_t hash = 0;
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorParameter entry;
|
||||
entry.behaviorID = tableData.getIntField("behaviorID", -1);
|
||||
auto candidateStringToAdd = std::string(tableData.getStringField("parameterID", ""));
|
||||
auto parameter = m_ParametersList.find(candidateStringToAdd);
|
||||
if (parameter != m_ParametersList.end()) {
|
||||
entry.parameterID = parameter;
|
||||
} else {
|
||||
entry.parameterID = m_ParametersList.insert(std::make_pair(candidateStringToAdd, uniqueParameterId)).first;
|
||||
uniqueParameterId++;
|
||||
}
|
||||
hash = entry.behaviorID;
|
||||
hash = (hash << 31U) | entry.parameterID->second;
|
||||
entry.value = tableData.getFloatField("value", -1.0f);
|
||||
|
||||
int32_t behaviorID = query.getIntField(0, -1);
|
||||
std::string parameterID = query.getStringField(1, "");
|
||||
|
||||
GeneralUtils::hash_combine(hash, behaviorID);
|
||||
GeneralUtils::hash_combine(hash, parameterID);
|
||||
|
||||
float value = query.getFloatField(2, -1.0f);
|
||||
|
||||
return std::make_pair(hash, value);
|
||||
}, [](int32_t size) {
|
||||
return 40 * 1000 * 1000;
|
||||
}, false);
|
||||
m_Entries.insert(std::make_pair(hash, entry));
|
||||
}
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) {}
|
||||
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
|
||||
auto parameterID = this->m_ParametersList.find(name);
|
||||
if (parameterID == this->m_ParametersList.end()) return defaultValue;
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorParameterTable::GetName(void) const {
|
||||
return "BehaviorParameter";
|
||||
uint64_t hash = behaviorID;
|
||||
|
||||
hash = (hash << 31U) | parameterID->second;
|
||||
|
||||
// Search for specific parameter
|
||||
const auto& it = m_Entries.find(hash);
|
||||
return it != m_Entries.end() ? it->second.value : defaultValue;
|
||||
}
|
||||
|
||||
float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue)
|
||||
{
|
||||
size_t hash = 0;
|
||||
GeneralUtils::hash_combine(hash, behaviorID);
|
||||
GeneralUtils::hash_combine(hash, name);
|
||||
|
||||
return BehaviorParameterProvider->GetEntry(hash, defaultValue);
|
||||
std::map<std::string, float> CDBehaviorParameterTable::GetParametersByBehaviorID(uint32_t behaviorID) {
|
||||
uint64_t hashBase = behaviorID;
|
||||
std::map<std::string, float> returnInfo;
|
||||
uint64_t hash;
|
||||
for (auto& parameterCandidate : m_ParametersList) {
|
||||
hash = (hashBase << 31U) | parameterCandidate.second;
|
||||
auto infoCandidate = m_Entries.find(hash);
|
||||
if (infoCandidate != m_Entries.end()) {
|
||||
returnInfo.insert(std::make_pair(infoCandidate->second.parameterID->first, infoCandidate->second.value));
|
||||
}
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
||||
|
||||
void CDBehaviorParameterTable::LoadHost()
|
||||
{
|
||||
BehaviorParameterProvider->LoadHost();
|
||||
}
|
||||
|
||||
@@ -5,34 +5,19 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
/*!
|
||||
\file CDBehaviorParameterTable.hpp
|
||||
\brief Contains data for the BehaviorParameter table
|
||||
*/
|
||||
|
||||
//! BehaviorParameter Entry Struct
|
||||
struct CDBehaviorParameter {
|
||||
int32_t behaviorID; //!< The Behavior ID
|
||||
int32_t parameterID; //!< The Parameter ID
|
||||
float value; //!< The value of the behavior template
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
std::unordered_map<std::string, uint32_t>::iterator parameterID; //!< The Parameter ID
|
||||
float value; //!< The value of the behavior template
|
||||
};
|
||||
|
||||
//! BehaviorParameter table
|
||||
class CDBehaviorParameterTable : public CDTable {
|
||||
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
|
||||
private:
|
||||
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
|
||||
std::unordered_map<std::string, uint32_t> m_ParametersList;
|
||||
public:
|
||||
void LoadHost() override;
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorParameterTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBehaviorParameterTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
float GetEntry(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
||||
CDBehaviorParameterTable();
|
||||
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
||||
|
||||
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
|
||||
};
|
||||
|
||||
@@ -1,39 +1,67 @@
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
|
||||
#include "CDProvider.h"
|
||||
|
||||
CDBehaviorTemplate EmptyBehaviorTemplate {0, 0, 0, 0};
|
||||
|
||||
CD_PROVIDER(BehaviorTemplateProvider, uint32_t, CDBehaviorTemplate);
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
NEW_CD_PROVIDER(BehaviorTemplateProvider, "BehaviorTemplate", [](CppSQLite3Query& query) {
|
||||
CDBehaviorTemplate entry;
|
||||
|
||||
entry.behaviorID = query.getIntField(0, -1);
|
||||
entry.templateID = query.getIntField(1, -1);
|
||||
entry.effectID = query.getIntField(2, -1);
|
||||
entry.effectHandle = CDTable::SetString(query.getStringField(3, ""));
|
||||
|
||||
return std::make_pair(entry.behaviorID, entry);
|
||||
}, [](int32_t size) {
|
||||
return 40 * 1000 * 1000;
|
||||
}, false);
|
||||
|
||||
// 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("behaviorID", -1);
|
||||
entry.templateID = tableData.getIntField("templateID", -1);
|
||||
entry.effectID = tableData.getIntField("effectID", -1);
|
||||
auto candidateToAdd = tableData.getStringField(3, "");
|
||||
auto parameter = m_EffectHandles.find(candidateToAdd);
|
||||
if (parameter != m_EffectHandles.end()) {
|
||||
entry.effectHandle = parameter;
|
||||
} else {
|
||||
entry.effectHandle = m_EffectHandles.insert(candidateToAdd).first;
|
||||
}
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) {}
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorTemplateTable::GetName(void) const {
|
||||
return "BehaviorTemplate";
|
||||
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
const CDBehaviorTemplate& CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) const {
|
||||
return BehaviorTemplateProvider->GetEntry(behaviorID, EmptyBehaviorTemplate);
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
void CDBehaviorTemplateTable::LoadHost() {
|
||||
BehaviorTemplateProvider->LoadHost();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
/*!
|
||||
\file CDBehaviorTemplateTable.hpp
|
||||
\brief Contains data for the BehaviorTemplate table
|
||||
*/
|
||||
|
||||
//! BehaviorTemplate Entry Struct
|
||||
struct CDBehaviorTemplate {
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
unsigned int templateID; //!< The Template ID (LOT)
|
||||
@@ -19,22 +13,17 @@ struct CDBehaviorTemplate {
|
||||
};
|
||||
|
||||
|
||||
//! BehaviorTemplate table
|
||||
class CDBehaviorTemplateTable : public CDTable {
|
||||
class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable> {
|
||||
private:
|
||||
std::vector<CDBehaviorTemplate> entries;
|
||||
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
|
||||
std::unordered_set<std::string> m_EffectHandles;
|
||||
public:
|
||||
void LoadHost() override;
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorTemplateTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBehaviorTemplateTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
const CDBehaviorTemplate& GetByBehaviorID(const uint32_t behaviorID) const;
|
||||
CDBehaviorTemplateTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
|
||||
|
||||
std::vector<CDBehaviorTemplate> GetEntries(void) const;
|
||||
|
||||
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "CDBrickIDTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
@@ -21,8 +20,8 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BrickIDTable");
|
||||
while (!tableData.eof()) {
|
||||
CDBrickIDTable entry;
|
||||
entry.NDObjectID = tableData.getIntField(0, -1);
|
||||
entry.LEGOBrickID = tableData.getIntField(1, -1);
|
||||
entry.NDObjectID = tableData.getIntField("NDObjectID", -1);
|
||||
entry.LEGOBrickID = tableData.getIntField("LEGOBrickID", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -31,15 +30,6 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBrickIDTableTable::~CDBrickIDTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBrickIDTableTable::GetName(void) const {
|
||||
return "BrickIDTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
|
||||
|
||||
std::vector<CDBrickIDTable> data = cpplinq::from(this->entries)
|
||||
@@ -49,7 +39,7 @@ std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBric
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,34 +16,14 @@ struct CDBrickIDTable {
|
||||
|
||||
|
||||
//! BrickIDTable table
|
||||
class CDBrickIDTableTable : public CDTable {
|
||||
class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable> {
|
||||
private:
|
||||
std::vector<CDBrickIDTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDBrickIDTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBrickIDTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDBrickIDTableTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDBrickIDTable> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -1,49 +1,94 @@
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
#define CDCLIENT_CACHE_ALL
|
||||
|
||||
#include "CDProvider.h"
|
||||
|
||||
CD_PROVIDER(ComponentsRegistryProvider, size_t, int32_t);
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
|
||||
NEW_CD_PROVIDER(ComponentsRegistryProvider, "ComponentsRegistry", [](CppSQLite3Query& query) {
|
||||
size_t hash = 0;
|
||||
|
||||
int32_t componentID = query.getIntField(0, -1);
|
||||
int32_t componentType = query.getIntField(1, -1);
|
||||
|
||||
hash = componentID;
|
||||
hash = hash << 32;
|
||||
hash |= componentType;
|
||||
|
||||
int32_t componentHandle = query.getIntField(2, -1);
|
||||
|
||||
return std::make_pair(hash, componentHandle);
|
||||
}, [](int32_t size) {
|
||||
return 10 * 1000 * 1000;
|
||||
}, true);
|
||||
|
||||
#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("id", -1);
|
||||
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) {}
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
|
||||
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDComponentsRegistryTable::GetName(void) const {
|
||||
return "ComponentsRegistry";
|
||||
if (iter == this->mappedEntries.end()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
// 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("id", -1);
|
||||
entry.component_type = tableData.getIntField("component_type", -1);
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
|
||||
//Darwin's stuff:
|
||||
const auto& it = this->mappedEntries.find(entry.id);
|
||||
if (it != mappedEntries.end()) {
|
||||
const auto& iter = it->second.find(entry.component_type);
|
||||
if (iter == it->second.end()) {
|
||||
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
|
||||
}
|
||||
} else {
|
||||
std::map<unsigned int, unsigned int> map;
|
||||
map.insert(std::make_pair(entry.component_type, entry.component_id));
|
||||
this->mappedEntries.insert(std::make_pair(entry.id, map));
|
||||
}
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
const auto& it2 = this->mappedEntries.find(id);
|
||||
if (it2 != mappedEntries.end()) {
|
||||
const auto& iter = it2->second.find(componentType);
|
||||
if (iter != it2->second.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue) {
|
||||
size_t hash = 0;
|
||||
hash = id;
|
||||
hash = hash << 32;
|
||||
hash |= componentType;
|
||||
|
||||
return ComponentsRegistryProvider->GetEntry(hash, defaultValue);
|
||||
}
|
||||
|
||||
void CDComponentsRegistryTable::LoadHost() {
|
||||
ComponentsRegistryProvider->LoadHost();
|
||||
}
|
||||
|
||||
@@ -3,51 +3,19 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDComponentsRegistryTable.hpp
|
||||
\brief Contains data for the ComponentsRegistry table
|
||||
*/
|
||||
|
||||
//! ComponentsRegistry Entry Struct
|
||||
enum class eReplicaComponentType : uint32_t;
|
||||
struct CDComponentsRegistry {
|
||||
unsigned int id; //!< The LOT is used as the ID
|
||||
unsigned int component_type; //!< See ComponentTypes enum for values
|
||||
eReplicaComponentType 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 {
|
||||
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
|
||||
private:
|
||||
//std::vector<CDComponentsRegistry> entries;
|
||||
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
public:
|
||||
void LoadHost() override;
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDComponentsRegistryTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! 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);
|
||||
CDComponentsRegistryTable();
|
||||
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
|
||||
};
|
||||
|
||||
@@ -21,11 +21,11 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
|
||||
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);
|
||||
entry.currencyIndex = tableData.getIntField("currencyIndex", -1);
|
||||
entry.npcminlevel = tableData.getIntField("npcminlevel", -1);
|
||||
entry.minvalue = tableData.getIntField("minvalue", -1);
|
||||
entry.maxvalue = tableData.getIntField("maxvalue", -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -34,15 +34,6 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDCurrencyTableTable::~CDCurrencyTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDCurrencyTableTable::GetName(void) const {
|
||||
return "CurrencyTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) {
|
||||
|
||||
std::vector<CDCurrencyTable> data = cpplinq::from(this->entries)
|
||||
@@ -52,7 +43,7 @@ std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCu
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,34 +18,14 @@ struct CDCurrencyTable {
|
||||
};
|
||||
|
||||
//! CurrencyTable table
|
||||
class CDCurrencyTableTable : public CDTable {
|
||||
class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable> {
|
||||
private:
|
||||
std::vector<CDCurrencyTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDCurrencyTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDCurrencyTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDCurrencyTableTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDCurrencyTable> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -21,20 +21,20 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.faction = tableData.getIntField("faction", -1);
|
||||
entry.factionList = tableData.getStringField("factionList", "");
|
||||
entry.life = tableData.getIntField("life", -1);
|
||||
entry.imagination = tableData.getIntField("imagination", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
|
||||
entry.level = tableData.getIntField("level", -1);
|
||||
entry.armor = tableData.getFloatField("armor", -1.0f);
|
||||
entry.death_behavior = tableData.getIntField("death_behavior", -1);
|
||||
entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false;
|
||||
entry.attack_priority = tableData.getIntField("attack_priority", -1);
|
||||
entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false;
|
||||
entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -43,15 +43,6 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDDestructibleComponentTable::GetName(void) const {
|
||||
return "DestructibleComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) {
|
||||
|
||||
std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries)
|
||||
@@ -61,7 +52,7 @@ std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::fu
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDDestructibleComponentTable.hpp
|
||||
\brief Contains data for the DestructibleComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
struct CDDestructibleComponent {
|
||||
unsigned int id; //!< The component ID from the ComponentsRegistry Table
|
||||
int faction; //!< The Faction ID of the object
|
||||
@@ -26,35 +20,14 @@ struct CDDestructibleComponent {
|
||||
int difficultyLevel; //!< ???
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDDestructibleComponentTable : public CDTable {
|
||||
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
|
||||
private:
|
||||
std::vector<CDDestructibleComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDDestructibleComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDDestructibleComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDDestructibleComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDDestructibleComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -5,14 +5,14 @@ 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);
|
||||
entry->ID = tableData.getIntField("id", -1);
|
||||
entry->animationName = tableData.getStringField("animationName", "");
|
||||
entry->iconFilename = tableData.getStringField("iconFilename", "");
|
||||
entry->channel = tableData.getIntField("channel", -1);
|
||||
entry->locked = tableData.getIntField("locked", -1) != 0;
|
||||
entry->localize = tableData.getIntField("localize", -1) != 0;
|
||||
entry->locState = tableData.getIntField("locStatus", -1);
|
||||
entry->gateVersion = tableData.getStringField("gate_version", "");
|
||||
|
||||
entries.insert(std::make_pair(entry->ID, entry));
|
||||
tableData.nextRow();
|
||||
@@ -30,11 +30,6 @@ CDEmoteTableTable::~CDEmoteTableTable(void) {
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDEmoteTableTable::GetName(void) const {
|
||||
return "Emotes";
|
||||
}
|
||||
|
||||
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
||||
for (auto e : entries) {
|
||||
if (e.first == id) return e.second;
|
||||
@@ -42,3 +37,4 @@ CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
|
||||
/*!
|
||||
\file CDEmoteTable.hpp
|
||||
\brief Contains data for the CDEmoteTable table
|
||||
*/
|
||||
|
||||
//! CDEmoteEntry Struct
|
||||
struct CDEmoteTable {
|
||||
CDEmoteTable() {
|
||||
ID = -1;
|
||||
@@ -19,7 +13,7 @@ struct CDEmoteTable {
|
||||
channel = -1;
|
||||
locked = false;
|
||||
localize = false;
|
||||
gateVersion = -1;
|
||||
gateVersion = "";
|
||||
}
|
||||
|
||||
int ID;
|
||||
@@ -29,28 +23,16 @@ struct CDEmoteTable {
|
||||
int channel;
|
||||
bool locked;
|
||||
bool localize;
|
||||
int gateVersion;
|
||||
std::string gateVersion;
|
||||
};
|
||||
|
||||
//! CDEmoteTable table
|
||||
class CDEmoteTableTable : public CDTable {
|
||||
class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
|
||||
private:
|
||||
std::map<int, CDEmoteTable*> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDEmoteTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDEmoteTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Returns an emote by ID
|
||||
CDEmoteTableTable();
|
||||
~CDEmoteTableTable();
|
||||
// Returns an emote by ID
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
};
|
||||
|
||||
@@ -21,11 +21,11 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
|
||||
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, "");
|
||||
entry.featureName = tableData.getStringField("featureName", "");
|
||||
entry.major = tableData.getIntField("major", -1);
|
||||
entry.current = tableData.getIntField("current", -1);
|
||||
entry.minor = tableData.getIntField("minor", -1);
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -34,15 +34,6 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDFeatureGatingTable::~CDFeatureGatingTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDFeatureGatingTable::GetName(void) const {
|
||||
return "FeatureGating";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) {
|
||||
|
||||
std::vector<CDFeatureGating> data = cpplinq::from(this->entries)
|
||||
@@ -62,7 +53,7 @@ bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDFeatureGatingTable.hpp
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
struct CDFeatureGating {
|
||||
std::string featureName;
|
||||
int32_t major;
|
||||
@@ -16,37 +11,16 @@ struct CDFeatureGating {
|
||||
std::string description;
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDFeatureGatingTable : public CDTable {
|
||||
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
|
||||
private:
|
||||
std::vector<CDFeatureGating> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDFeatureGatingTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDFeatureGatingTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDFeatureGatingTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
|
||||
|
||||
bool FeatureUnlocked(const std::string& feature) const;
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDFeatureGating> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -21,10 +21,10 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
|
||||
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;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.itemid = tableData.getIntField("itemid", -1);
|
||||
entry.count = tableData.getIntField("count", -1);
|
||||
entry.equip = tableData.getIntField("equip", -1) == 1 ? true : false;
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -33,15 +33,6 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDInventoryComponentTable::~CDInventoryComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDInventoryComponentTable::GetName(void) const {
|
||||
return "InventoryComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) {
|
||||
|
||||
std::vector<CDInventoryComponent> data = cpplinq::from(this->entries)
|
||||
@@ -51,7 +42,7 @@ std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDInventoryComponentTable.hpp
|
||||
\brief Contains data for the InventoryComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
struct CDInventoryComponent {
|
||||
unsigned int id; //!< The component ID for this object
|
||||
unsigned int itemid; //!< The LOT of the object
|
||||
@@ -16,35 +10,14 @@ struct CDInventoryComponent {
|
||||
bool equip; //!< Whether or not to equip the item
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDInventoryComponentTable : public CDTable {
|
||||
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
|
||||
private:
|
||||
std::vector<CDInventoryComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDInventoryComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDInventoryComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDInventoryComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDInventoryComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -23,48 +23,48 @@ CDItemComponentTable::CDItemComponentTable(void) {
|
||||
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, 0);
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.equipLocation = tableData.getStringField("equipLocation", "");
|
||||
entry.baseValue = tableData.getIntField("baseValue", -1);
|
||||
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField("rarity", 0);
|
||||
entry.itemType = tableData.getIntField("itemType", -1);
|
||||
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
|
||||
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
|
||||
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
|
||||
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
|
||||
entry.stackSize = tableData.getIntField("stackSize", -1);
|
||||
entry.color1 = tableData.getIntField("color1", -1);
|
||||
entry.decal = tableData.getIntField("decal", -1);
|
||||
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
|
||||
entry.buildTypes = tableData.getIntField("buildTypes", -1);
|
||||
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
|
||||
entry.animationFlag = tableData.getIntField("animationFlag", 0);
|
||||
entry.equipEffects = tableData.getIntField("equipEffects", -1);
|
||||
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField("itemRating", -1);
|
||||
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
|
||||
entry.delResIndex = tableData.getIntField("delResIndex", -1);
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
entry.audioEventUse = tableData.getStringField("audioEventUse", "");
|
||||
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
|
||||
entry.commendationCost = tableData.getIntField("commendationCost", -1);
|
||||
entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.forgeType = tableData.getIntField("forgeType", -1);
|
||||
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -74,14 +74,6 @@ CDItemComponentTable::CDItemComponentTable(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemComponentTable::~CDItemComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemComponentTable::GetName(void) const {
|
||||
return "ItemComponent";
|
||||
}
|
||||
|
||||
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
|
||||
const auto& it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
@@ -101,48 +93,48 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
|
||||
|
||||
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, 0);
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.equipLocation = tableData.getStringField("equipLocation", "");
|
||||
entry.baseValue = tableData.getIntField("baseValue", -1);
|
||||
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField("rarity", 0);
|
||||
entry.itemType = tableData.getIntField("itemType", -1);
|
||||
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
|
||||
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
|
||||
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
|
||||
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
|
||||
entry.stackSize = tableData.getIntField("stackSize", -1);
|
||||
entry.color1 = tableData.getIntField("color1", -1);
|
||||
entry.decal = tableData.getIntField("decal", -1);
|
||||
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
|
||||
entry.buildTypes = tableData.getIntField("buildTypes", -1);
|
||||
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
|
||||
entry.animationFlag = tableData.getIntField("animationFlag", 0);
|
||||
entry.equipEffects = tableData.getIntField("equipEffects", -1);
|
||||
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField("itemRating", -1);
|
||||
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
|
||||
entry.delResIndex = tableData.getIntField("delResIndex", -1);
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
|
||||
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
|
||||
entry.commendationCost = tableData.getIntField("commendationCost", -1);
|
||||
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.forgeType = tableData.getIntField("forgeType", -1);
|
||||
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -177,3 +169,4 @@ std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDIt
|
||||
|
||||
return currencies;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
#include "CDTable.h"
|
||||
#include "dCommonVars.h"
|
||||
|
||||
/*!
|
||||
\file CDItemComponentTable.hpp
|
||||
\brief Contains data for the ItemComponent table
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
struct CDItemComponent {
|
||||
unsigned int id; //!< The Component ID
|
||||
std::string equipLocation; //!< The equip location
|
||||
@@ -55,28 +49,15 @@ struct CDItemComponent {
|
||||
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDItemComponentTable : public CDTable {
|
||||
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDItemComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDItemComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDItemComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
CDItemComponentTable();
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
//! Gets an entry by ID
|
||||
// Gets an entry by ID
|
||||
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
|
||||
|
||||
static CDItemComponent Default;
|
||||
|
||||
@@ -21,9 +21,9 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
|
||||
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);
|
||||
entry.SkillSetID = tableData.getIntField("SkillSetID", -1);
|
||||
entry.SkillID = tableData.getIntField("SkillID", -1);
|
||||
entry.SkillCastType = tableData.getIntField("SkillCastType", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -32,15 +32,6 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemSetSkillsTable::GetName(void) const {
|
||||
return "ItemSetSkills";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) {
|
||||
|
||||
std::vector<CDItemSetSkills> data = cpplinq::from(this->entries)
|
||||
@@ -50,7 +41,6 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDIt
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
@@ -3,50 +3,22 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDItemSetSkillsTable.hpp
|
||||
\brief Contains data for the ItemSetSkills table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
struct CDItemSetSkills {
|
||||
unsigned int SkillSetID; //!< The skill set ID
|
||||
unsigned int SkillID; //!< The skill ID
|
||||
unsigned int SkillCastType; //!< The skill cast type
|
||||
};
|
||||
|
||||
//! ItemSets table
|
||||
class CDItemSetSkillsTable : public CDTable {
|
||||
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
|
||||
private:
|
||||
std::vector<CDItemSetSkills> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDItemSetSkillsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDItemSetSkillsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDItemSetSkillsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDItemSetSkills> GetEntries(void) const;
|
||||
|
||||
std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,21 +21,21 @@ CDItemSetsTable::CDItemSetsTable(void) {
|
||||
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);
|
||||
entry.setID = tableData.getIntField("setID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.itemIDs = tableData.getStringField("itemIDs", "");
|
||||
entry.kitType = tableData.getIntField("kitType", -1);
|
||||
entry.kitRank = tableData.getIntField("kitRank", -1);
|
||||
entry.kitImage = tableData.getIntField("kitImage", -1);
|
||||
entry.skillSetWith2 = tableData.getIntField("skillSetWith2", -1);
|
||||
entry.skillSetWith3 = tableData.getIntField("skillSetWith3", -1);
|
||||
entry.skillSetWith4 = tableData.getIntField("skillSetWith4", -1);
|
||||
entry.skillSetWith5 = tableData.getIntField("skillSetWith5", -1);
|
||||
entry.skillSetWith6 = tableData.getIntField("skillSetWith6", -1);
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
entry.kitID = tableData.getIntField("kitID", -1);
|
||||
entry.priority = tableData.getFloatField("priority", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -44,15 +44,6 @@ CDItemSetsTable::CDItemSetsTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDItemSetsTable::~CDItemSetsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDItemSetsTable::GetName(void) const {
|
||||
return "ItemSets";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
|
||||
|
||||
std::vector<CDItemSets> data = cpplinq::from(this->entries)
|
||||
@@ -62,7 +53,7 @@ std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> p
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDItemSetsTable.hpp
|
||||
\brief Contains data for the ItemSets table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
struct CDItemSets {
|
||||
unsigned int setID; //!< The item set ID
|
||||
unsigned int locStatus; //!< The loc status
|
||||
@@ -27,36 +21,15 @@ struct CDItemSets {
|
||||
float priority; //!< The priority
|
||||
};
|
||||
|
||||
//! ItemSets table
|
||||
class CDItemSetsTable : public CDTable {
|
||||
class CDItemSetsTable : public CDTable<CDItemSetsTable> {
|
||||
private:
|
||||
std::vector<CDItemSets> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDItemSetsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDItemSetsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDItemSetsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDItemSets> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
|
||||
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, "");
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.requiredUScore = tableData.getIntField("requiredUScore", -1);
|
||||
entry.BehaviorEffect = tableData.getStringField("BehaviorEffect", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -32,14 +32,6 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLevelProgressionLookupTable::GetName(void) const {
|
||||
return "LevelProgressionLookup";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {
|
||||
|
||||
@@ -54,3 +46,4 @@ std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::
|
||||
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,47 +3,21 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDLevelProgressionLookupTable.hpp
|
||||
\brief Contains data for the LevelProgressionLookup table
|
||||
*/
|
||||
|
||||
//! LevelProgressionLookup Entry Struct
|
||||
struct CDLevelProgressionLookup {
|
||||
unsigned int id; //!< The Level ID
|
||||
unsigned int requiredUScore; //!< The required LEGO Score
|
||||
std::string BehaviorEffect; //!< The behavior effect attached to this
|
||||
};
|
||||
|
||||
//! LevelProgressionLookup table
|
||||
class CDLevelProgressionLookupTable : public CDTable {
|
||||
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
|
||||
private:
|
||||
std::vector<CDLevelProgressionLookup> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDLevelProgressionLookupTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDLevelProgressionLookupTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDLevelProgressionLookupTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -21,15 +21,15 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
|
||||
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, ""));
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
|
||||
entry.RarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
|
||||
entry.percent = tableData.getFloatField("percent", -1.0f);
|
||||
entry.minToDrop = tableData.getIntField("minToDrop", -1);
|
||||
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.flagID = tableData.getIntField("flagID", -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -38,15 +38,6 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLootMatrixTable::~CDLootMatrixTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLootMatrixTable::GetName(void) const {
|
||||
return "LootMatrix";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatrix)> predicate) {
|
||||
|
||||
std::vector<CDLootMatrix> data = cpplinq::from(this->entries)
|
||||
@@ -56,7 +47,7 @@ std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatr
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDLootMatrixTable.hpp
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! LootMatrix Struct
|
||||
struct CDLootMatrix {
|
||||
unsigned int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
@@ -21,36 +15,15 @@ struct CDLootMatrix {
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDLootMatrixTable : public CDTable {
|
||||
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
|
||||
private:
|
||||
std::vector<CDLootMatrix> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDLootMatrixTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDLootMatrixTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDLootMatrixTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDLootMatrix>& GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ CDLootTableTable::CDLootTableTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.itemid = tableData.getIntField("itemid", -1);
|
||||
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.MissionDrop = tableData.getIntField("MissionDrop", -1) == 1 ? true : false;
|
||||
entry.sortPriority = tableData.getIntField("sortPriority", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -35,14 +35,6 @@ CDLootTableTable::CDLootTableTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDLootTableTable::~CDLootTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDLootTableTable::GetName(void) const {
|
||||
return "LootTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) {
|
||||
|
||||
@@ -57,3 +49,4 @@ std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)
|
||||
const std::vector<CDLootTable>& CDLootTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDLootTableTable.hpp
|
||||
\brief Contains data for the LootTable table
|
||||
*/
|
||||
|
||||
//! LootTable Struct
|
||||
struct CDLootTable {
|
||||
unsigned int itemid; //!< The LOT of the item
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
@@ -17,36 +11,15 @@ struct CDLootTable {
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
};
|
||||
|
||||
//! LootTable table
|
||||
class CDLootTableTable : public CDTable {
|
||||
class CDLootTableTable : public CDTable<CDLootTableTable> {
|
||||
private:
|
||||
std::vector<CDLootTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDLootTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDLootTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDLootTableTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDLootTable>& GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
|
||||
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, "");
|
||||
entry.ID = tableData.getIntField("ID", -1);
|
||||
entry.messageType = tableData.getIntField("messageType", -1);
|
||||
entry.notificationGroup = tableData.getIntField("notificationGroup", -1);
|
||||
entry.missionID = tableData.getIntField("missionID", -1);
|
||||
entry.attachmentLOT = tableData.getIntField("attachmentLOT", 0);
|
||||
entry.localize = (bool)tableData.getIntField("localize", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -37,14 +37,6 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionEmailTable::~CDMissionEmailTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionEmailTable::GetName(void) const {
|
||||
return "MissionEmail";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {
|
||||
|
||||
@@ -59,3 +51,4 @@ std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMiss
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDMissionEmailTable.hpp
|
||||
\brief Contains data for the MissionEmail table
|
||||
*/
|
||||
|
||||
//! MissionEmail Entry Struct
|
||||
struct CDMissionEmail {
|
||||
unsigned int ID;
|
||||
unsigned int messageType;
|
||||
@@ -21,35 +15,14 @@ struct CDMissionEmail {
|
||||
};
|
||||
|
||||
|
||||
//! MissionEmail table
|
||||
class CDMissionEmailTable : public CDTable {
|
||||
class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
|
||||
private:
|
||||
std::vector<CDMissionEmail> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionEmailTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionEmailTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDMissionEmailTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMissionEmail> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -21,11 +21,11 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
|
||||
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, "");
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.missionID = tableData.getIntField("missionID", -1);
|
||||
entry.offersMission = tableData.getIntField("offersMission", -1) == 1 ? true : false;
|
||||
entry.acceptsMission = tableData.getIntField("acceptsMission", -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -34,14 +34,6 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionNPCComponentTable::GetName(void) const {
|
||||
return "MissionNPCComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {
|
||||
|
||||
@@ -56,3 +48,4 @@ std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::functi
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDMissionNPCComponentTable.hpp
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! MissionNPCComponent Struct
|
||||
struct CDMissionNPCComponent {
|
||||
unsigned int id; //!< The ID
|
||||
unsigned int missionID; //!< The Mission ID
|
||||
@@ -17,35 +11,16 @@ struct CDMissionNPCComponent {
|
||||
std::string gate_version; //!< The gate version
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDMissionNPCComponentTable : public CDTable {
|
||||
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
|
||||
private:
|
||||
std::vector<CDMissionNPCComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionNPCComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionNPCComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDMissionNPCComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
std::vector<CDMissionNPCComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -21,19 +21,19 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
|
||||
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, ""));
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.taskType = tableData.getIntField("taskType", -1);
|
||||
entry.target = tableData.getIntField("target", -1);
|
||||
entry.targetGroup = tableData.getStringField("targetGroup", "");
|
||||
entry.targetValue = tableData.getIntField("targetValue", -1);
|
||||
entry.taskParam1 = tableData.getStringField("taskParam1", "");
|
||||
UNUSED(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
|
||||
UNUSED(entry.IconID = tableData.getIntField("IconID", -1));
|
||||
entry.uid = tableData.getIntField("uid", -1);
|
||||
UNUSED(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -42,15 +42,6 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionTasksTable::~CDMissionTasksTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionTasksTable::GetName(void) const {
|
||||
return "MissionTasks";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) {
|
||||
|
||||
std::vector<CDMissionTasks> data = cpplinq::from(this->entries)
|
||||
@@ -74,7 +65,7 @@ std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missio
|
||||
return tasks;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDMissionTasksTable.hpp
|
||||
\brief Contains data for the MissionTasks table
|
||||
*/
|
||||
|
||||
//! ObjectSkills Struct
|
||||
struct CDMissionTasks {
|
||||
unsigned int id; //!< The Mission ID that the task belongs to
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
@@ -25,37 +19,17 @@ struct CDMissionTasks {
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDMissionTasksTable : public CDTable {
|
||||
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
|
||||
private:
|
||||
std::vector<CDMissionTasks> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionTasksTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionTasksTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDMissionTasksTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
|
||||
|
||||
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissionTasks>& GetEntries(void) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -23,58 +23,58 @@ CDMissionsTable::CDMissionsTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.defined_type = tableData.getStringField("defined_type", "");
|
||||
entry.defined_subtype = tableData.getStringField("defined_subtype", "");
|
||||
entry.UISortOrder = tableData.getIntField("UISortOrder", -1);
|
||||
entry.offer_objectID = tableData.getIntField("offer_objectID", -1);
|
||||
entry.target_objectID = tableData.getIntField("target_objectID", -1);
|
||||
entry.reward_currency = tableData.getInt64Field("reward_currency", -1);
|
||||
entry.LegoScore = tableData.getIntField("LegoScore", -1);
|
||||
entry.reward_reputation = tableData.getIntField("reward_reputation", -1);
|
||||
entry.isChoiceReward = tableData.getIntField("isChoiceReward", -1) == 1 ? true : false;
|
||||
entry.reward_item1 = tableData.getIntField("reward_item1", 0);
|
||||
entry.reward_item1_count = tableData.getIntField("reward_item1_count", 0);
|
||||
entry.reward_item2 = tableData.getIntField("reward_item2", 0);
|
||||
entry.reward_item2_count = tableData.getIntField("reward_item2_count", 0);
|
||||
entry.reward_item3 = tableData.getIntField("reward_item3", 0);
|
||||
entry.reward_item3_count = tableData.getIntField("reward_item3_count", 0);
|
||||
entry.reward_item4 = tableData.getIntField("reward_item4", 0);
|
||||
entry.reward_item4_count = tableData.getIntField("reward_item4_count", 0);
|
||||
entry.reward_emote = tableData.getIntField("reward_emote", -1);
|
||||
entry.reward_emote2 = tableData.getIntField("reward_emote2", -1);
|
||||
entry.reward_emote3 = tableData.getIntField("reward_emote3", -1);
|
||||
entry.reward_emote4 = tableData.getIntField("reward_emote4", -1);
|
||||
entry.reward_maximagination = tableData.getIntField("reward_maximagination", -1);
|
||||
entry.reward_maxhealth = tableData.getIntField("reward_maxhealth", -1);
|
||||
entry.reward_maxinventory = tableData.getIntField("reward_maxinventory", -1);
|
||||
entry.reward_maxmodel = tableData.getIntField("reward_maxmodel", -1);
|
||||
entry.reward_maxwidget = tableData.getIntField("reward_maxwidget", -1);
|
||||
entry.reward_maxwallet = tableData.getIntField("reward_maxwallet", -1);
|
||||
entry.repeatable = tableData.getIntField("repeatable", -1) == 1 ? true : false;
|
||||
entry.reward_currency_repeatable = tableData.getIntField("reward_currency_repeatable", -1);
|
||||
entry.reward_item1_repeatable = tableData.getIntField("reward_item1_repeatable", -1);
|
||||
entry.reward_item1_repeat_count = tableData.getIntField("reward_item1_repeat_count", -1);
|
||||
entry.reward_item2_repeatable = tableData.getIntField("reward_item2_repeatable", -1);
|
||||
entry.reward_item2_repeat_count = tableData.getIntField("reward_item2_repeat_count", -1);
|
||||
entry.reward_item3_repeatable = tableData.getIntField("reward_item3_repeatable", -1);
|
||||
entry.reward_item3_repeat_count = tableData.getIntField("reward_item3_repeat_count", -1);
|
||||
entry.reward_item4_repeatable = tableData.getIntField("reward_item4_repeatable", -1);
|
||||
entry.reward_item4_repeat_count = tableData.getIntField("reward_item4_repeat_count", -1);
|
||||
entry.time_limit = tableData.getIntField("time_limit", -1);
|
||||
entry.isMission = tableData.getIntField("isMission", -1) ? true : false;
|
||||
entry.missionIconID = tableData.getIntField("missionIconID", -1);
|
||||
entry.prereqMissionID = tableData.getStringField("prereqMissionID", "");
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.inMOTD = tableData.getIntField("inMOTD", -1) == 1 ? true : false;
|
||||
entry.cooldownTime = tableData.getInt64Field("cooldownTime", -1);
|
||||
entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false;
|
||||
entry.randomPool = tableData.getStringField("randomPool", "");
|
||||
entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -85,15 +85,6 @@ CDMissionsTable::CDMissionsTable(void) {
|
||||
Default.id = -1;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMissionsTable::~CDMissionsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMissionsTable::GetName(void) const {
|
||||
return "Missions";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) {
|
||||
|
||||
std::vector<CDMissions> data = cpplinq::from(this->entries)
|
||||
@@ -103,7 +94,6 @@ std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> p
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
@@ -131,3 +121,4 @@ const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& foun
|
||||
|
||||
return Default;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,12 +5,6 @@
|
||||
#include <map>
|
||||
#include <cstdint>
|
||||
|
||||
/*!
|
||||
\file CDMissionsTable.hpp
|
||||
\brief Contains data for the Missions table
|
||||
*/
|
||||
|
||||
//! Missions Struct
|
||||
struct CDMissions {
|
||||
int id; //!< The Mission ID
|
||||
std::string defined_type; //!< The type of mission
|
||||
@@ -66,35 +60,16 @@ struct CDMissions {
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
//! Missions table
|
||||
class CDMissionsTable : public CDTable {
|
||||
class CDMissionsTable : public CDTable<CDMissionsTable> {
|
||||
private:
|
||||
std::vector<CDMissions> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDMissionsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
const std::vector<CDMissions>& GetEntries(void) const;
|
||||
|
||||
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
|
||||
|
||||
@@ -21,14 +21,14 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MovementAIComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDMovementAIComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.MovementType = tableData.getStringField(1, "");
|
||||
entry.WanderChance = tableData.getFloatField(2, -1.0f);
|
||||
entry.WanderDelayMin = tableData.getFloatField(3, -1.0f);
|
||||
entry.WanderDelayMax = tableData.getFloatField(4, -1.0f);
|
||||
entry.WanderSpeed = tableData.getFloatField(5, -1.0f);
|
||||
entry.WanderRadius = tableData.getFloatField(6, -1.0f);
|
||||
entry.attachedPath = tableData.getStringField(7, "");
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.MovementType = tableData.getStringField("MovementType", "");
|
||||
entry.WanderChance = tableData.getFloatField("WanderChance", -1.0f);
|
||||
entry.WanderDelayMin = tableData.getFloatField("WanderDelayMin", -1.0f);
|
||||
entry.WanderDelayMax = tableData.getFloatField("WanderDelayMax", -1.0f);
|
||||
entry.WanderSpeed = tableData.getFloatField("WanderSpeed", -1.0f);
|
||||
entry.WanderRadius = tableData.getFloatField("WanderRadius", -1.0f);
|
||||
entry.attachedPath = tableData.getStringField("attachedPath", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -37,14 +37,6 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDMovementAIComponentTable::~CDMovementAIComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDMovementAIComponentTable::GetName(void) const {
|
||||
return "MovementAIComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::function<bool(CDMovementAIComponent)> predicate) {
|
||||
|
||||
@@ -59,3 +51,4 @@ std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::functi
|
||||
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDMovementAIComponentTable.hpp
|
||||
\brief Contains data for the MovementAIComponent table
|
||||
*/
|
||||
|
||||
//! MovementAIComponent Struct
|
||||
struct CDMovementAIComponent {
|
||||
unsigned int id;
|
||||
std::string MovementType;
|
||||
@@ -20,36 +14,15 @@ struct CDMovementAIComponent {
|
||||
std::string attachedPath;
|
||||
};
|
||||
|
||||
//! MovementAIComponent table
|
||||
class CDMovementAIComponentTable : public CDTable {
|
||||
class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable> {
|
||||
private:
|
||||
std::vector<CDMovementAIComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMovementAIComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMovementAIComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDMovementAIComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
std::vector<CDMovementAIComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ CDObjectSkillsTable::CDObjectSkillsTable(void) {
|
||||
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);
|
||||
entry.objectTemplate = tableData.getIntField("objectTemplate", -1);
|
||||
entry.skillID = tableData.getIntField("skillID", -1);
|
||||
entry.castOnType = tableData.getIntField("castOnType", -1);
|
||||
entry.AICombatWeight = tableData.getIntField("AICombatWeight", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -33,14 +33,6 @@ CDObjectSkillsTable::CDObjectSkillsTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDObjectSkillsTable::~CDObjectSkillsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDObjectSkillsTable::GetName(void) const {
|
||||
return "ObjectSkills";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) {
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDObjectSkillsTable.hpp
|
||||
\brief Contains data for the ObjectSkills table
|
||||
*/
|
||||
|
||||
//! ObjectSkills Struct
|
||||
struct CDObjectSkills {
|
||||
unsigned int objectTemplate; //!< The LOT of the item
|
||||
unsigned int skillID; //!< The Skill ID of the object
|
||||
@@ -16,35 +10,16 @@ struct CDObjectSkills {
|
||||
unsigned int AICombatWeight; //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectSkillsTable : public CDTable {
|
||||
class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable> {
|
||||
private:
|
||||
std::vector<CDObjectSkills> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDObjectSkillsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDObjectSkillsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDObjectSkillsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
std::vector<CDObjectSkills> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -18,20 +18,20 @@ CDObjectsTable::CDObjectsTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.name = tableData.getStringField("name", "");
|
||||
entry.placeable = tableData.getIntField("placeable", -1);
|
||||
entry.type = tableData.getStringField("type", "");
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
entry.localize = tableData.getIntField("localize", -1);
|
||||
entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1);
|
||||
entry.displayName = tableData.getStringField("displayName", "");
|
||||
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
|
||||
entry.nametag = tableData.getIntField("nametag", -1);
|
||||
entry._internalNotes = tableData.getStringField("_internalNotes", "");
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
entry.HQ_valid = tableData.getIntField("HQ_valid", -1);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -43,14 +43,6 @@ CDObjectsTable::CDObjectsTable(void) {
|
||||
m_default.id = 0;
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDObjectsTable::~CDObjectsTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDObjectsTable::GetName(void) const {
|
||||
return "Objects";
|
||||
}
|
||||
|
||||
const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
const auto& it = this->entries.find(LOT);
|
||||
if (it != this->entries.end()) {
|
||||
@@ -71,20 +63,20 @@ const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
// 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, "");
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.name = tableData.getStringField("name", "");
|
||||
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
|
||||
entry.type = tableData.getStringField("type", "");
|
||||
UNUSED(ntry.description = tableData.getStringField(4, ""));
|
||||
UNUSED(entry.localize = tableData.getIntField(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));
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1));
|
||||
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
|
||||
UNUSED(entry.displayName = tableData.getStringField("displayName", ""));
|
||||
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
|
||||
UNUSED(entry.nametag = tableData.getIntField("nametag", -1));
|
||||
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -100,3 +92,4 @@ const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
|
||||
return m_default;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDObjectsTable.hpp
|
||||
\brief Contains data for the Objects table
|
||||
*/
|
||||
|
||||
//! RebuildComponent Struct
|
||||
struct CDObjects {
|
||||
unsigned int id; //!< The LOT of the object
|
||||
std::string name; //!< The internal name of the object
|
||||
@@ -26,29 +20,14 @@ struct CDObjects {
|
||||
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectsTable : public CDTable {
|
||||
class CDObjectsTable : public CDTable<CDObjectsTable> {
|
||||
private:
|
||||
//std::vector<CDObjects> entries;
|
||||
std::map<unsigned int, CDObjects> entries;
|
||||
CDObjects m_default;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDObjectsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDObjectsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Gets an entry by ID
|
||||
CDObjectsTable();
|
||||
// Gets an entry by ID
|
||||
const CDObjects& GetByID(unsigned int LOT);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PackageComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDPackageComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(1, -1);
|
||||
entry.packageType = tableData.getIntField(2, -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.packageType = tableData.getIntField("packageType", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -32,14 +32,6 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDPackageComponentTable::~CDPackageComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDPackageComponentTable::GetName(void) const {
|
||||
return "PackageComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) {
|
||||
|
||||
@@ -54,3 +46,4 @@ std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<boo
|
||||
std::vector<CDPackageComponent> CDPackageComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,48 +3,20 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDPackageComponentTable.hpp
|
||||
\brief Contains data for the PackageComponent table
|
||||
*/
|
||||
|
||||
//! PackageComponent Entry Struct
|
||||
struct CDPackageComponent {
|
||||
unsigned int id;
|
||||
unsigned int LootMatrixIndex;
|
||||
unsigned int packageType;
|
||||
};
|
||||
|
||||
|
||||
//! PackageComponent table
|
||||
class CDPackageComponentTable : public CDTable {
|
||||
class CDPackageComponentTable : public CDTable<CDPackageComponentTable> {
|
||||
private:
|
||||
std::vector<CDPackageComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDPackageComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDPackageComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDPackageComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -4,22 +4,22 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDPhysicsComponent* entry = new CDPhysicsComponent();
|
||||
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);
|
||||
UNUSED(entry->doublejump = tableData.getIntField(4, -1) != 0);
|
||||
entry->speed = tableData.getFloatField(5, -1);
|
||||
UNUSED(entry->rotSpeed = tableData.getFloatField(6, -1));
|
||||
entry->playerHeight = tableData.getFloatField(7);
|
||||
entry->playerRadius = tableData.getFloatField(8);
|
||||
entry->pcShapeType = tableData.getIntField(9);
|
||||
entry->collisionGroup = tableData.getIntField(10);
|
||||
UNUSED(entry->airSpeed = tableData.getFloatField(11));
|
||||
UNUSED(entry->boundaryAsset = tableData.getStringField(12));
|
||||
UNUSED(entry->jumpAirSpeed = tableData.getFloatField(13));
|
||||
UNUSED(entry->friction = tableData.getFloatField(14));
|
||||
UNUSED(entry->gravityVolumeAsset = tableData.getStringField(15));
|
||||
entry->id = tableData.getIntField("id", -1);
|
||||
entry->bStatic = tableData.getIntField("static", -1) != 0;
|
||||
entry->physicsAsset = tableData.getStringField("physics_asset", "");
|
||||
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
|
||||
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
|
||||
entry->speed = tableData.getFloatField("speed", -1);
|
||||
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
|
||||
entry->playerHeight = tableData.getFloatField("playerHeight");
|
||||
entry->playerRadius = tableData.getFloatField("playerRadius");
|
||||
entry->pcShapeType = tableData.getIntField("pcShapeType");
|
||||
entry->collisionGroup = tableData.getIntField("collisionGroup");
|
||||
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
|
||||
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
|
||||
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
|
||||
UNUSED(entry->friction = tableData.getFloatField("friction"));
|
||||
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -28,7 +28,7 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
|
||||
CDPhysicsComponentTable::~CDPhysicsComponentTable() {
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
@@ -36,10 +36,6 @@ CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
|
||||
m_entries.clear();
|
||||
}
|
||||
|
||||
std::string CDPhysicsComponentTable::GetName(void) const {
|
||||
return "PhysicsComponent";
|
||||
}
|
||||
|
||||
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.first == componentID) return e.second;
|
||||
@@ -47,3 +43,4 @@ CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ struct CDPhysicsComponent {
|
||||
UNUSED(std::string gravityVolumeAsset);
|
||||
};
|
||||
|
||||
class CDPhysicsComponentTable : public CDTable {
|
||||
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {
|
||||
public:
|
||||
CDPhysicsComponentTable(void);
|
||||
~CDPhysicsComponentTable(void);
|
||||
CDPhysicsComponentTable();
|
||||
~CDPhysicsComponentTable();
|
||||
|
||||
std::string GetName(void) const override;
|
||||
static const std::string GetTableName() { return "PhysicsComponent"; };
|
||||
CDPhysicsComponent* GetByID(unsigned int componentID);
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,11 +18,11 @@ CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
|
||||
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, "")
|
||||
static_cast<uint32_t>(tableData.getIntField("id", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
|
||||
tableData.getStringField("propertyName", ""),
|
||||
static_cast<bool>(tableData.getIntField("isOnProperty", false)),
|
||||
tableData.getStringField("groupType", "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
@@ -32,12 +32,6 @@ CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPropertyEntranceComponentTable::~CDPropertyEntranceComponentTable(void) = default;
|
||||
|
||||
std::string CDPropertyEntranceComponentTable::GetName() const {
|
||||
return "PropertyEntranceComponent";
|
||||
}
|
||||
|
||||
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == id)
|
||||
@@ -46,3 +40,4 @@ CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t i
|
||||
|
||||
return defaultEntry;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,31 +9,13 @@ struct CDPropertyEntranceComponent {
|
||||
std::string groupType;
|
||||
};
|
||||
|
||||
class CDPropertyEntranceComponentTable : public CDTable {
|
||||
class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable> {
|
||||
public:
|
||||
//! Constructor
|
||||
CDPropertyEntranceComponentTable();
|
||||
|
||||
//! Destructor
|
||||
~CDPropertyEntranceComponentTable();
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
// Queries the table with a custom "where" clause
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
// Gets all the entries in the table
|
||||
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
|
||||
private:
|
||||
std::vector<CDPropertyEntranceComponent> entries{};
|
||||
|
||||
@@ -17,10 +17,10 @@ CDPropertyTemplateTable::CDPropertyTemplateTable() {
|
||||
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, "")
|
||||
static_cast<uint32_t>(tableData.getIntField("id", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("vendorMapID", -1)),
|
||||
tableData.getStringField("spawnName", "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
@@ -30,12 +30,6 @@ CDPropertyTemplateTable::CDPropertyTemplateTable() {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPropertyTemplateTable::~CDPropertyTemplateTable() = default;
|
||||
|
||||
std::string CDPropertyTemplateTable::GetName() const {
|
||||
return "PropertyTemplate";
|
||||
}
|
||||
|
||||
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.mapID == mapID)
|
||||
@@ -44,3 +38,4 @@ CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
|
||||
|
||||
return defaultEntry;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,12 +8,11 @@ struct CDPropertyTemplate {
|
||||
std::string spawnName;
|
||||
};
|
||||
|
||||
class CDPropertyTemplateTable : public CDTable {
|
||||
class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable> {
|
||||
public:
|
||||
CDPropertyTemplateTable();
|
||||
~CDPropertyTemplateTable();
|
||||
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
static const std::string GetTableName() { return "PropertyTemplate"; };
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
private:
|
||||
std::vector<CDPropertyTemplate> entries{};
|
||||
|
||||
@@ -21,10 +21,10 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ProximityMonitorComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDProximityMonitorComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.Proximities = tableData.getStringField(1, "");
|
||||
entry.LoadOnClient = tableData.getIntField(2, -1);
|
||||
entry.LoadOnServer = tableData.getIntField(3, -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.Proximities = tableData.getStringField("Proximities", "");
|
||||
entry.LoadOnClient = tableData.getIntField("LoadOnClient", -1);
|
||||
entry.LoadOnServer = tableData.getIntField("LoadOnServer", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -33,14 +33,6 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDProximityMonitorComponentTable::~CDProximityMonitorComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDProximityMonitorComponentTable::GetName(void) const {
|
||||
return "ProximityMonitorComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query(std::function<bool(CDProximityMonitorComponent)> predicate) {
|
||||
|
||||
@@ -55,3 +47,4 @@ std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query
|
||||
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDProximityMonitorComponentTable.hpp
|
||||
\brief Contains data for the ProximityMonitorComponent table
|
||||
*/
|
||||
|
||||
//! ProximityMonitorComponent Entry Struct
|
||||
struct CDProximityMonitorComponent {
|
||||
unsigned int id;
|
||||
std::string Proximities;
|
||||
@@ -16,36 +10,14 @@ struct CDProximityMonitorComponent {
|
||||
bool LoadOnServer;
|
||||
};
|
||||
|
||||
|
||||
//! ProximityMonitorComponent table
|
||||
class CDProximityMonitorComponentTable : public CDTable {
|
||||
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable> {
|
||||
private:
|
||||
std::vector<CDProximityMonitorComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDProximityMonitorComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDProximityMonitorComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDProximityMonitorComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
@@ -6,35 +6,35 @@ CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
|
||||
while (!tableData.eof()) {
|
||||
CDRailActivatorComponent entry;
|
||||
|
||||
entry.id = tableData.getIntField(0);
|
||||
entry.id = tableData.getIntField("id", 0);
|
||||
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField(1, ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField(2, ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField(3, ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField(4, ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField(5, ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField(6, ""));
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startAnim", ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopAnim", ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopAnim", ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startSound", ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopSound", ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopSound", ""));
|
||||
|
||||
std::string loopEffectString(tableData.getStringField(7, ""));
|
||||
std::string loopEffectString(tableData.getStringField("effectIDs", ""));
|
||||
entry.loopEffectID = EffectPairFromString(loopEffectString);
|
||||
|
||||
entry.preconditions = tableData.getStringField(8, "-1");
|
||||
entry.preconditions = tableData.getStringField("preconditions", "-1");
|
||||
|
||||
entry.playerCollision = tableData.getIntField(9, 0);
|
||||
entry.playerCollision = tableData.getIntField("playerCollision", 0);
|
||||
|
||||
entry.cameraLocked = tableData.getIntField(10, 0);
|
||||
entry.cameraLocked = tableData.getIntField("cameraLocked", 0);
|
||||
|
||||
std::string startEffectString(tableData.getStringField(11, ""));
|
||||
std::string startEffectString(tableData.getStringField("StartEffectID", ""));
|
||||
entry.startEffectID = EffectPairFromString(startEffectString);
|
||||
|
||||
std::string stopEffectString(tableData.getStringField(12, ""));
|
||||
std::string stopEffectString(tableData.getStringField("StopEffectID", ""));
|
||||
entry.stopEffectID = EffectPairFromString(stopEffectString);
|
||||
|
||||
entry.damageImmune = tableData.getIntField(13, 0);
|
||||
entry.damageImmune = tableData.getIntField("DamageImmune", 0);
|
||||
|
||||
entry.noAggro = tableData.getIntField(14, 0);
|
||||
entry.noAggro = tableData.getIntField("NoAggro", 0);
|
||||
|
||||
entry.showNameBillboard = tableData.getIntField(15, 0);
|
||||
entry.showNameBillboard = tableData.getIntField("ShowNameBillboard", 0);
|
||||
|
||||
m_Entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -43,12 +43,6 @@ CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDRailActivatorComponentTable::~CDRailActivatorComponentTable() = default;
|
||||
|
||||
std::string CDRailActivatorComponentTable::GetName() const {
|
||||
return "RailActivatorComponent";
|
||||
}
|
||||
|
||||
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
|
||||
for (const auto& entry : m_Entries) {
|
||||
if (entry.id == id)
|
||||
@@ -70,3 +64,4 @@ std::pair<uint32_t, std::u16string> CDRailActivatorComponentTable::EffectPairFro
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,12 +20,10 @@ struct CDRailActivatorComponent {
|
||||
bool showNameBillboard;
|
||||
};
|
||||
|
||||
class CDRailActivatorComponentTable : public CDTable {
|
||||
class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable> {
|
||||
public:
|
||||
CDRailActivatorComponentTable();
|
||||
~CDRailActivatorComponentTable();
|
||||
|
||||
std::string GetName() const override;
|
||||
static const std::string GetTableName() { return "RailActivatorComponent"; };
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
|
||||
private:
|
||||
|
||||
@@ -21,10 +21,10 @@ CDRarityTableTable::CDRarityTableTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.randmax = tableData.getFloatField("randmax", -1);
|
||||
entry.rarity = tableData.getIntField("rarity", -1);
|
||||
entry.RarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -33,14 +33,6 @@ CDRarityTableTable::CDRarityTableTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDRarityTableTable::~CDRarityTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDRarityTableTable::GetName(void) const {
|
||||
return "RarityTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarityTable)> predicate) {
|
||||
|
||||
@@ -55,3 +47,4 @@ std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarity
|
||||
const std::vector<CDRarityTable>& CDRarityTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDRarityTableTable.hpp
|
||||
\brief Contains data for the RarityTable table
|
||||
*/
|
||||
|
||||
//! RarityTable Entry Struct
|
||||
struct CDRarityTable {
|
||||
unsigned int id;
|
||||
float randmax;
|
||||
@@ -32,37 +26,15 @@ struct CDRarityTable {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! RarityTable table
|
||||
class CDRarityTableTable : public CDTable {
|
||||
class CDRarityTableTable : public CDTable<CDRarityTableTable> {
|
||||
private:
|
||||
std::vector<CDRarityTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDRarityTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDRarityTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDRarityTableTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDRarityTable>& GetEntries(void) const;
|
||||
|
||||
const std::vector<CDRarityTable>& GetEntries() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -21,16 +21,16 @@ CDRebuildComponentTable::CDRebuildComponentTable(void) {
|
||||
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);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.reset_time = tableData.getFloatField("reset_time", -1.0f);
|
||||
entry.complete_time = tableData.getFloatField("complete_time", -1.0f);
|
||||
entry.take_imagination = tableData.getIntField("take_imagination", -1);
|
||||
entry.interruptible = tableData.getIntField("interruptible", -1) == 1 ? true : false;
|
||||
entry.self_activator = tableData.getIntField("self_activator", -1) == 1 ? true : false;
|
||||
entry.custom_modules = tableData.getStringField("custom_modules", "");
|
||||
entry.activityID = tableData.getIntField("activityID", -1);
|
||||
entry.post_imagination_cost = tableData.getIntField("post_imagination_cost", -1);
|
||||
entry.time_before_smash = tableData.getFloatField("time_before_smash", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -39,14 +39,6 @@ CDRebuildComponentTable::CDRebuildComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDRebuildComponentTable::~CDRebuildComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDRebuildComponentTable::GetName(void) const {
|
||||
return "RebuildComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) {
|
||||
|
||||
@@ -61,3 +53,4 @@ std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<boo
|
||||
std::vector<CDRebuildComponent> CDRebuildComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDRebuildComponentTable.hpp
|
||||
\brief Contains data for the RebuildComponent table
|
||||
*/
|
||||
|
||||
//! RebuildComponent Struct
|
||||
struct CDRebuildComponent {
|
||||
unsigned int id; //!< The component Id
|
||||
float reset_time; //!< The reset time
|
||||
@@ -22,36 +16,15 @@ struct CDRebuildComponent {
|
||||
float time_before_smash; //!< The time before smash
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDRebuildComponentTable : public CDTable {
|
||||
class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable> {
|
||||
private:
|
||||
std::vector<CDRebuildComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDRebuildComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDRebuildComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDRebuildComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDRebuildComponent> GetEntries(void) const;
|
||||
|
||||
std::vector<CDRebuildComponent> GetEntries() const;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ CDRewardsTable::CDRewardsTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
||||
while (!tableData.eof()) {
|
||||
CDRewards* entry = new CDRewards();
|
||||
entry->id = tableData.getIntField(0, -1);
|
||||
entry->levelID = tableData.getIntField(1, -1);
|
||||
entry->missionID = tableData.getIntField(2, -1);
|
||||
entry->rewardType = tableData.getIntField(3, -1);
|
||||
entry->value = tableData.getIntField(4, -1);
|
||||
entry->count = tableData.getIntField(5, -1);
|
||||
entry->id = tableData.getIntField("id", -1);
|
||||
entry->levelID = tableData.getIntField("LevelID", -1);
|
||||
entry->missionID = tableData.getIntField("MissionID", -1);
|
||||
entry->rewardType = tableData.getIntField("RewardType", -1);
|
||||
entry->value = tableData.getIntField("value", -1);
|
||||
entry->count = tableData.getIntField("count", -1);
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -26,10 +26,6 @@ CDRewardsTable::~CDRewardsTable(void) {
|
||||
m_entries.clear();
|
||||
}
|
||||
|
||||
std::string CDRewardsTable::GetName(void) const {
|
||||
return "Rewards";
|
||||
}
|
||||
|
||||
std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
||||
std::vector<CDRewards*> result{};
|
||||
for (const auto& e : m_entries) {
|
||||
@@ -38,3 +34,4 @@ std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@ struct CDRewards {
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
class CDRewardsTable : public CDTable {
|
||||
class CDRewardsTable : public CDTable<CDRewardsTable> {
|
||||
public:
|
||||
CDRewardsTable(void);
|
||||
~CDRewardsTable(void);
|
||||
CDRewardsTable();
|
||||
~CDRewardsTable();
|
||||
|
||||
std::string GetName(void) const override;
|
||||
static const std::string GetTableName() { return "Rewards"; };
|
||||
std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
|
||||
|
||||
private:
|
||||
|
||||
@@ -18,9 +18,9 @@ CDScriptComponentTable::CDScriptComponentTable(void) {
|
||||
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, "");
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.script_name = tableData.getStringField("script_name", "");
|
||||
entry.client_script_name = tableData.getStringField("client_script_name", "");
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
@@ -29,14 +29,6 @@ CDScriptComponentTable::CDScriptComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDScriptComponentTable::~CDScriptComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDScriptComponentTable::GetName(void) const {
|
||||
return "ScriptComponent";
|
||||
}
|
||||
|
||||
const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
|
||||
std::map<unsigned int, CDScriptComponent>::iterator it = this->entries.find(id);
|
||||
if (it != this->entries.end()) {
|
||||
@@ -45,3 +37,4 @@ const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
|
||||
|
||||
return m_ToReturnWhenNoneFound;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,44 +3,20 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDScriptComponentTable.hpp
|
||||
\brief Contains data for the ScriptComponent table
|
||||
*/
|
||||
|
||||
//! ScriptComponent Struct
|
||||
struct CDScriptComponent {
|
||||
unsigned int id; //!< The component ID
|
||||
std::string script_name; //!< The script name
|
||||
std::string client_script_name; //!< The client script name
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDScriptComponentTable : public CDTable {
|
||||
class CDScriptComponentTable : public CDTable<CDScriptComponentTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
CDScriptComponent m_ToReturnWhenNoneFound;
|
||||
|
||||
public:
|
||||
//! Gets an entry by ID
|
||||
CDScriptComponentTable();
|
||||
// Gets an entry by scriptID
|
||||
const CDScriptComponent& GetByID(unsigned int id);
|
||||
|
||||
//! Constructor
|
||||
CDScriptComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDScriptComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -23,25 +23,25 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
|
||||
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));
|
||||
entry.skillID = tableData.getIntField("skillID", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.behaviorID = tableData.getIntField("behaviorID", -1);
|
||||
entry.imaginationcost = tableData.getIntField("imaginationcost", -1);
|
||||
entry.cooldowngroup = tableData.getIntField("cooldowngroup", -1);
|
||||
entry.cooldown = tableData.getFloatField("cooldown", -1.0f);
|
||||
UNUSED(entry.isNpcEditor = tableData.getIntField("isNpcEditor", -1) == 1 ? true : false);
|
||||
UNUSED(entry.skillIcon = tableData.getIntField("skillIcon", -1));
|
||||
UNUSED(entry.oomSkillID = tableData.getStringField("oomSkillID", ""));
|
||||
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField("oomBehaviorEffectID", -1));
|
||||
UNUSED(entry.castTypeDesc = tableData.getIntField("castTypeDesc", -1));
|
||||
UNUSED(entry.imBonusUI = tableData.getIntField("imBonusUI", -1));
|
||||
UNUSED(entry.lifeBonusUI = tableData.getIntField("lifeBonusUI", -1));
|
||||
UNUSED(entry.armorBonusUI = tableData.getIntField("armorBonusUI", -1));
|
||||
UNUSED(entry.damageUI = tableData.getIntField("damageUI", -1));
|
||||
UNUSED(entry.hideIcon = tableData.getIntField("hideIcon", -1) == 1 ? true : false);
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.cancelType = tableData.getIntField("cancelType", -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
@@ -51,24 +51,8 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDSkillBehaviorTable::~CDSkillBehaviorTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDSkillBehaviorTable::GetName(void) const {
|
||||
return "SkillBehavior";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDSkillBehavior> CDSkillBehaviorTable::Query(std::function<bool(CDSkillBehavior)> predicate) {
|
||||
|
||||
/*std::vector<CDSkillBehavior> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;*/
|
||||
|
||||
//Logger::LogDebug("CDSkillBehaviorTable", "The 'Query' function is no longer working! Please use GetSkillByID instead!");
|
||||
std::vector<CDSkillBehavior> data; //So MSVC shuts up
|
||||
return data;
|
||||
}
|
||||
@@ -82,3 +66,4 @@ const CDSkillBehavior& CDSkillBehaviorTable::GetSkillByID(unsigned int skillID)
|
||||
|
||||
return m_empty;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDSkillBehaviorTable.hpp
|
||||
\brief Contains data for the SkillBehavior table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
struct CDSkillBehavior {
|
||||
unsigned int skillID; //!< The Skill ID of the skill
|
||||
UNUSED(unsigned int locStatus); //!< ??
|
||||
@@ -31,33 +25,17 @@ struct CDSkillBehavior {
|
||||
UNUSED(unsigned int cancelType); //!< The cancel type (?)
|
||||
};
|
||||
|
||||
//! SkillBehavior table
|
||||
class CDSkillBehaviorTable : public CDTable {
|
||||
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDSkillBehaviorTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDSkillBehaviorTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDSkillBehaviorTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
|
||||
|
||||
//! Gets an entry by ID
|
||||
// Gets an entry by skillID
|
||||
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
|
||||
};
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "../CDClientDatabase.h"
|
||||
#include "CDClientDatabase.h"
|
||||
#include "Singleton.h"
|
||||
#include "DluAssert.h"
|
||||
|
||||
// C++
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -16,6 +16,12 @@
|
||||
#endif
|
||||
#include "cpplinq.hpp"
|
||||
|
||||
// Used for legacy
|
||||
#define UNUSED(x)
|
||||
|
||||
// Enable this to skip some unused columns in some tables
|
||||
#define UNUSED_COLUMN(v)
|
||||
|
||||
#pragma warning (disable : 4244) //Disable double to float conversion warnings
|
||||
#pragma warning (disable : 4715) //Disable "not all control paths return a value"
|
||||
|
||||
@@ -30,7 +36,8 @@ typedef __int64_t __int64;
|
||||
*/
|
||||
|
||||
//! The base class for all CD tables
|
||||
class CDTable {
|
||||
template<class Table>
|
||||
class CDTable : public Singleton<Table> {
|
||||
public:
|
||||
|
||||
//! Returns the table's name
|
||||
@@ -61,4 +68,19 @@ public:
|
||||
\return The handle to the string
|
||||
*/
|
||||
static size_t SetString(std::string value);
|
||||
|
||||
protected:
|
||||
virtual ~CDTable() = default;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class LookupResult {
|
||||
typedef std::pair<T, bool> DataType;
|
||||
public:
|
||||
LookupResult() { m_data.first = T(); m_data.second = false; };
|
||||
LookupResult(T& data) { m_data.first = data; m_data.second = true; };
|
||||
inline const T& Data() { return m_data.first; };
|
||||
inline const bool& FoundData() { return m_data.second; };
|
||||
private:
|
||||
DataType m_data;
|
||||
};
|
||||
|
||||
@@ -21,11 +21,11 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM VendorComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDVendorComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.buyScalar = tableData.getFloatField(1, -1.0f);
|
||||
entry.sellScalar = tableData.getFloatField(2, -1.0f);
|
||||
entry.refreshTimeSeconds = tableData.getFloatField(3, -1.0f);
|
||||
entry.LootMatrixIndex = tableData.getIntField(4, -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.buyScalar = tableData.getFloatField("buyScalar", -1.0f);
|
||||
entry.sellScalar = tableData.getFloatField("sellScalar", -1.0f);
|
||||
entry.refreshTimeSeconds = tableData.getFloatField("refreshTimeSeconds", -1.0f);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
@@ -34,14 +34,6 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDVendorComponentTable::~CDVendorComponentTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDVendorComponentTable::GetName(void) const {
|
||||
return "VendorComponent";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) {
|
||||
|
||||
@@ -56,3 +48,4 @@ std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(
|
||||
std::vector<CDVendorComponent> CDVendorComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDVendorComponentTable.hpp
|
||||
\brief Contains data for the VendorComponent table
|
||||
*/
|
||||
|
||||
//! VendorComponent Struct
|
||||
struct CDVendorComponent {
|
||||
unsigned int id; //!< The Component ID
|
||||
float buyScalar; //!< Buy Scalar (what does that mean?)
|
||||
@@ -17,36 +11,15 @@ struct CDVendorComponent {
|
||||
unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
|
||||
};
|
||||
|
||||
//! VendorComponent table
|
||||
class CDVendorComponentTable : public CDTable {
|
||||
class CDVendorComponentTable : public CDTable<CDVendorComponentTable> {
|
||||
private:
|
||||
std::vector<CDVendorComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDVendorComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDVendorComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
CDVendorComponentTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDVendorComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -18,33 +18,33 @@ CDZoneTableTable::CDZoneTableTable(void) {
|
||||
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);
|
||||
entry.zoneID = tableData.getIntField("zoneID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.zoneName = tableData.getStringField("zoneName", "");
|
||||
entry.scriptID = tableData.getIntField("scriptID", -1);
|
||||
entry.ghostdistance_min = tableData.getFloatField("ghostdistance_min", -1.0f);
|
||||
entry.ghostdistance = tableData.getFloatField("ghostdistance", -1.0f);
|
||||
entry.population_soft_cap = tableData.getIntField("population_soft_cap", -1);
|
||||
entry.population_hard_cap = tableData.getIntField("population_hard_cap", -1);
|
||||
UNUSED(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
|
||||
UNUSED(entry.mapFolder = tableData.getStringField("mapFolder", ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
|
||||
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
|
||||
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
|
||||
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
|
||||
entry.petsAllowed = tableData.getIntField("petsAllowed", -1) == 1 ? true : false;
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
|
||||
UNUSED(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
|
||||
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
|
||||
|
||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||
tableData.nextRow();
|
||||
@@ -53,14 +53,6 @@ CDZoneTableTable::CDZoneTableTable(void) {
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDZoneTableTable::~CDZoneTableTable(void) {}
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDZoneTableTable::GetName(void) const {
|
||||
return "ZoneTable";
|
||||
}
|
||||
|
||||
//! Queries the table with a zoneID to find.
|
||||
const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
|
||||
const auto& iter = m_Entries.find(zoneID);
|
||||
@@ -71,3 +63,4 @@ const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,6 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDZoneTableTable.hpp
|
||||
\brief Contains data for the ZoneTable table
|
||||
*/
|
||||
|
||||
//! ZoneTable Struct
|
||||
struct CDZoneTable {
|
||||
unsigned int zoneID; //!< The Zone ID of the object
|
||||
unsigned int locStatus; //!< The Locale Status(?)
|
||||
@@ -39,28 +33,13 @@ struct CDZoneTable {
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
//! ZoneTable table
|
||||
class CDZoneTableTable : public CDTable {
|
||||
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDZoneTable> m_Entries;
|
||||
|
||||
public:
|
||||
CDZoneTableTable();
|
||||
|
||||
//! Constructor
|
||||
CDZoneTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDZoneTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a zoneID to find.
|
||||
/*!
|
||||
\param id The zoneID
|
||||
*/
|
||||
// Queries the table with a zoneID to find.
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user