mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Public release of the DLU server code!
Have fun!
This commit is contained in:
72
dDatabase/Tables/CDActivitiesTable.cpp
Normal file
72
dDatabase/Tables/CDActivitiesTable.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDActivitiesTable::CDActivitiesTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Activities");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
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);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
66
dDatabase/Tables/CDActivitiesTable.h
Normal file
66
dDatabase/Tables/CDActivitiesTable.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
// 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;
|
||||
unsigned int instanceMapID;
|
||||
unsigned int minTeams;
|
||||
unsigned int maxTeams;
|
||||
unsigned int minTeamSize;
|
||||
unsigned int maxTeamSize;
|
||||
unsigned int waitTime;
|
||||
unsigned int startDelay;
|
||||
bool requiresUniqueData;
|
||||
unsigned int leaderboardType;
|
||||
bool localize;
|
||||
int optionalCostLOT;
|
||||
int optionalCostCount;
|
||||
bool showUIRewards;
|
||||
unsigned int CommunityActivityFlagID;
|
||||
std::string gate_version;
|
||||
bool noTeamLootOnDeath;
|
||||
float optionalPercentage;
|
||||
};
|
||||
|
||||
|
||||
//! Activities table
|
||||
class CDActivitiesTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
60
dDatabase/Tables/CDActivityRewardsTable.cpp
Normal file
60
dDatabase/Tables/CDActivityRewardsTable.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include "CDActivityRewardsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ActivityRewards");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
|
||||
while (!tableData.eof()) {
|
||||
CDActivityRewards entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.ActivityRewardIndex = tableData.getIntField(1, -1);
|
||||
entry.activityRating = tableData.getIntField(2, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(3, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(4, -1);
|
||||
entry.ChallengeRating = tableData.getIntField(5, -1);
|
||||
entry.description = tableData.getStringField(6, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
54
dDatabase/Tables/CDActivityRewardsTable.h
Normal file
54
dDatabase/Tables/CDActivityRewardsTable.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
int activityRating; //!< The activity rating
|
||||
unsigned int LootMatrixIndex; //!< The loot matrix index
|
||||
unsigned int CurrencyIndex; //!< The currency index
|
||||
unsigned int ChallengeRating; //!< The challenge rating
|
||||
std::string description; //!< The description
|
||||
};
|
||||
|
||||
|
||||
//! ActivityRewards table
|
||||
class CDActivityRewardsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDActivityRewards> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDActivityRewardsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDActivityRewardsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDActivityRewards> GetEntries(void) const;
|
||||
|
||||
};
|
66
dDatabase/Tables/CDAnimationsTable.cpp
Normal file
66
dDatabase/Tables/CDAnimationsTable.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "CDAnimationsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDAnimationsTable::CDAnimationsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
|
||||
while (!tableData.eof()) {
|
||||
CDAnimations entry;
|
||||
entry.animationGroupID = tableData.getIntField(0, -1);
|
||||
entry.animation_type = tableData.getStringField(1, "");
|
||||
entry.animation_name = tableData.getStringField(2, "");
|
||||
entry.chance_to_play = tableData.getFloatField(3, -1.0f);
|
||||
entry.min_loops = tableData.getIntField(4, -1);
|
||||
entry.max_loops = tableData.getIntField(5, -1);
|
||||
entry.animation_length = tableData.getFloatField(6, -1.0f);
|
||||
entry.hideEquip = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.ignoreUpperBody = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.restartable = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.face_animation_name = tableData.getStringField(10, "");
|
||||
entry.priority = tableData.getFloatField(11, -1.0f);
|
||||
entry.blendTime = tableData.getFloatField(12, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDAnimationsTable::~CDAnimationsTable(void) { }
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDAnimationsTable::GetName(void) const {
|
||||
return "Animations";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
|
||||
|
||||
std::vector<CDAnimations> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
60
dDatabase/Tables/CDAnimationsTable.h
Normal file
60
dDatabase/Tables/CDAnimationsTable.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDAnimationsTable.hpp
|
||||
\brief Contains data for the Animations table
|
||||
*/
|
||||
|
||||
//! Animations Entry Struct
|
||||
struct CDAnimations {
|
||||
unsigned int animationGroupID; //!< The animation group ID
|
||||
std::string animation_type; //!< The animation type
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
unsigned int min_loops; //!< The minimum number of loops
|
||||
unsigned int max_loops; //!< The maximum number of loops
|
||||
float animation_length; //!< The animation length
|
||||
bool hideEquip; //!< Whether or not to hide the equip
|
||||
bool ignoreUpperBody; //!< Whether or not to ignore the upper body
|
||||
bool restartable; //!< Whether or not the animation is restartable
|
||||
std::string face_animation_name; //!< The face animation name
|
||||
float priority; //!< The priority
|
||||
float blendTime; //!< The blend time
|
||||
};
|
||||
|
||||
|
||||
//! Animations table
|
||||
class CDAnimationsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDAnimations> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDAnimationsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDAnimationsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDAnimations> GetEntries(void) const;
|
||||
|
||||
};
|
90
dDatabase/Tables/CDBehaviorParameterTable.cpp
Normal file
90
dDatabase/Tables/CDBehaviorParameterTable.cpp
Normal file
@@ -0,0 +1,90 @@
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorParameter entry;
|
||||
entry.behaviorID = tableData.getIntField(0, -1);
|
||||
entry.parameterID = tableData.getStringField(1, "");
|
||||
entry.value = tableData.getFloatField(2, -1.0f);
|
||||
|
||||
//Check if we have an entry with this ID:
|
||||
auto it = m_entries.find(entry.behaviorID);
|
||||
if (it != m_entries.end()) {
|
||||
it->second.insert(std::make_pair(entry.parameterID, entry.value));
|
||||
}
|
||||
else {
|
||||
//Otherwise, insert it:
|
||||
m_entries.insert(std::make_pair(entry.behaviorID, std::map<std::string, float>()));
|
||||
auto jit = m_entries.find(entry.behaviorID);
|
||||
|
||||
//Add our value as well:
|
||||
jit->second.insert(std::make_pair(entry.parameterID, entry.value));
|
||||
}
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) { }
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorParameterTable::GetName(void) const {
|
||||
return "BehaviorParameter";
|
||||
}
|
||||
|
||||
float CDBehaviorParameterTable::GetEntry(const uint32_t behaviorID, const std::string& name)
|
||||
{
|
||||
size_t hash = 0;
|
||||
GeneralUtils::hash_combine(hash, behaviorID);
|
||||
GeneralUtils::hash_combine(hash, name);
|
||||
|
||||
// Search for specific perameter
|
||||
const auto& it = m_Entries.find(hash);
|
||||
if (it != m_Entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// Check if this behavior has already been checked
|
||||
const auto& itChecked = m_Entries.find(behaviorID);
|
||||
if (itChecked != m_Entries.end()) {
|
||||
return itChecked->second;
|
||||
}
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT parameterID, value FROM BehaviorParameter WHERE behaviorID = " << std::to_string(behaviorID);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
|
||||
m_Entries.insert_or_assign(behaviorID, 0);
|
||||
|
||||
while (!tableData.eof()) {
|
||||
const std::string parameterID = tableData.getStringField(0, "");
|
||||
const float value = tableData.getFloatField(1, 0);
|
||||
|
||||
size_t parameterHash = 0;
|
||||
GeneralUtils::hash_combine(parameterHash, behaviorID);
|
||||
GeneralUtils::hash_combine(parameterHash, parameterID);
|
||||
|
||||
m_Entries.insert_or_assign(parameterHash, value);
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
const auto& it2 = m_Entries.find(hash);
|
||||
if (it2 != m_Entries.end()) {
|
||||
return it2->second;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
39
dDatabase/Tables/CDBehaviorParameterTable.h
Normal file
39
dDatabase/Tables/CDBehaviorParameterTable.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
|
||||
/*!
|
||||
\file CDBehaviorParameterTable.hpp
|
||||
\brief Contains data for the BehaviorParameter table
|
||||
*/
|
||||
|
||||
//! BehaviorParameter Entry Struct
|
||||
struct CDBehaviorParameter {
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
std::string parameterID; //!< The Parameter ID
|
||||
float value; //!< The value of the behavior template
|
||||
};
|
||||
|
||||
//! BehaviorParameter table
|
||||
class CDBehaviorParameterTable : public CDTable {
|
||||
private:
|
||||
std::map<size_t, float> m_Entries;
|
||||
|
||||
public:
|
||||
|
||||
//! 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);
|
||||
};
|
57
dDatabase/Tables/CDBehaviorTemplateTable.cpp
Normal file
57
dDatabase/Tables/CDBehaviorTemplateTable.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BehaviorTemplate");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorTemplate entry;
|
||||
entry.behaviorID = tableData.getIntField(0, -1);
|
||||
entry.templateID = tableData.getIntField(1, -1);
|
||||
entry.effectID = tableData.getIntField(2, -1);
|
||||
entry.effectHandle = tableData.getStringField(3, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) { }
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDBehaviorTemplateTable::GetName(void) const {
|
||||
return "BehaviorTemplate";
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
|
||||
|
||||
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
51
dDatabase/Tables/CDBehaviorTemplateTable.h
Normal file
51
dDatabase/Tables/CDBehaviorTemplateTable.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\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)
|
||||
unsigned int effectID; //!< The Effect ID attached
|
||||
std::string effectHandle; //!< The effect handle
|
||||
};
|
||||
|
||||
|
||||
//! BehaviorTemplate table
|
||||
class CDBehaviorTemplateTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDBehaviorTemplate> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDBehaviorTemplateTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDBehaviorTemplateTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDBehaviorTemplate> GetEntries(void) const;
|
||||
|
||||
};
|
55
dDatabase/Tables/CDBrickIDTableTable.cpp
Normal file
55
dDatabase/Tables/CDBrickIDTableTable.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "CDBrickIDTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BrickIDTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BrickIDTable");
|
||||
while (!tableData.eof()) {
|
||||
CDBrickIDTable entry;
|
||||
entry.NDObjectID = tableData.getIntField(0, -1);
|
||||
entry.LEGOBrickID = tableData.getIntField(1, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
49
dDatabase/Tables/CDBrickIDTableTable.h
Normal file
49
dDatabase/Tables/CDBrickIDTableTable.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDBrickIDTableTable.hpp
|
||||
\brief Contains data for the BrickIDTable table
|
||||
*/
|
||||
|
||||
//! BrickIDTable Entry Struct
|
||||
struct CDBrickIDTable {
|
||||
unsigned int NDObjectID;
|
||||
unsigned int LEGOBrickID;
|
||||
};
|
||||
|
||||
|
||||
//! BrickIDTable table
|
||||
class CDBrickIDTableTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
131
dDatabase/Tables/CDComponentsRegistryTable.cpp
Normal file
131
dDatabase/Tables/CDComponentsRegistryTable.cpp
Normal file
@@ -0,0 +1,131 @@
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
|
||||
#define CDCLIENT_CACHE_ALL
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t) entry.component_type) << 32 | ((uint64_t) entry.id), entry.component_id);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
|
||||
/*
|
||||
//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();
|
||||
#endif
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) { }
|
||||
|
||||
//! Returns the table's name
|
||||
std::string CDComponentsRegistryTable::GetName(void) const {
|
||||
return "ComponentsRegistry";
|
||||
}
|
||||
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue)
|
||||
{
|
||||
const auto& iter = this->mappedEntries.find(((uint64_t) componentType) << 32 | ((uint64_t) id));
|
||||
|
||||
if (iter == this->mappedEntries.end())
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
|
||||
/*
|
||||
const auto& it = this->mappedEntries.find(id);
|
||||
if (it != mappedEntries.end()) {
|
||||
const auto& iter = it->second.find(componentType);
|
||||
if (iter != it->second.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
// Now get the data
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM ComponentsRegistry WHERE id = " << std::to_string(id);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.component_type = tableData.getIntField(1, -1);
|
||||
entry.component_id = tableData.getIntField(2, -1);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
|
||||
//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
|
||||
}
|
40
dDatabase/Tables/CDComponentsRegistryTable.h
Normal file
40
dDatabase/Tables/CDComponentsRegistryTable.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDComponentsRegistryTable.hpp
|
||||
\brief Contains data for the ComponentsRegistry table
|
||||
*/
|
||||
|
||||
//! ComponentsRegistry Entry Struct
|
||||
struct CDComponentsRegistry {
|
||||
unsigned int id; //!< The LOT is used as the ID
|
||||
unsigned int component_type; //!< See ComponentTypes enum for values
|
||||
unsigned int component_id; //!< The ID used within the component's table (0 may either mean it's non-networked, or that the ID is actually 0
|
||||
};
|
||||
|
||||
|
||||
//! ComponentsRegistry table
|
||||
class CDComponentsRegistryTable : public CDTable {
|
||||
private:
|
||||
//std::vector<CDComponentsRegistry> entries;
|
||||
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDComponentsRegistryTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDComponentsRegistryTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
int32_t GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue = 0);
|
||||
};
|
58
dDatabase/Tables/CDCurrencyTableTable.cpp
Normal file
58
dDatabase/Tables/CDCurrencyTableTable.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "CDCurrencyTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDCurrencyTableTable::CDCurrencyTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM CurrencyTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM CurrencyTable");
|
||||
while (!tableData.eof()) {
|
||||
CDCurrencyTable entry;
|
||||
entry.currencyIndex = tableData.getIntField(0, -1);
|
||||
entry.npcminlevel = tableData.getIntField(1, -1);
|
||||
entry.minvalue = tableData.getIntField(2, -1);
|
||||
entry.maxvalue = tableData.getIntField(3, -1);
|
||||
entry.id = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
51
dDatabase/Tables/CDCurrencyTableTable.h
Normal file
51
dDatabase/Tables/CDCurrencyTableTable.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDCurrencyTableTable.hpp
|
||||
\brief Contains data for the CurrencyTable table
|
||||
*/
|
||||
|
||||
//! CurrencyTable Struct
|
||||
struct CDCurrencyTable {
|
||||
unsigned int currencyIndex; //!< The Currency Index
|
||||
unsigned int npcminlevel; //!< The minimum level of the npc
|
||||
unsigned int minvalue; //!< The minimum currency
|
||||
unsigned int maxvalue; //!< The maximum currency
|
||||
unsigned int id; //!< The ID of the currency index
|
||||
};
|
||||
|
||||
//! CurrencyTable table
|
||||
class CDCurrencyTableTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
67
dDatabase/Tables/CDDestructibleComponentTable.cpp
Normal file
67
dDatabase/Tables/CDDestructibleComponentTable.cpp
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM DestructibleComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM DestructibleComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDDestructibleComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.faction = tableData.getIntField(1, -1);
|
||||
entry.factionList = tableData.getStringField(2, "");
|
||||
entry.life = tableData.getIntField(3, -1);
|
||||
entry.imagination = tableData.getIntField(4, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(5, -1);
|
||||
entry.CurrencyIndex = tableData.getIntField(6, -1);
|
||||
entry.level = tableData.getIntField(7, -1);
|
||||
entry.armor = tableData.getFloatField(8, -1.0f);
|
||||
entry.death_behavior = tableData.getIntField(9, -1);
|
||||
entry.isnpc = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.attack_priority = tableData.getIntField(11, -1);
|
||||
entry.isSmashable = tableData.getIntField(12, -1) == 1 ? true : false;
|
||||
entry.difficultyLevel = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
60
dDatabase/Tables/CDDestructibleComponentTable.h
Normal file
60
dDatabase/Tables/CDDestructibleComponentTable.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
std::string factionList; //!< A list of the faction IDs
|
||||
int life; //!< The amount of life of the object
|
||||
unsigned int imagination; //!< The amount of imagination of the object
|
||||
int LootMatrixIndex; //!< The Loot Matrix Index
|
||||
int CurrencyIndex; //!< The Currency Index
|
||||
unsigned int level; //!< ???
|
||||
float armor; //!< The amount of armor of the object
|
||||
unsigned int death_behavior; //!< The behavior ID of the death behavior
|
||||
bool isnpc; //!< Whether or not the object is an NPC
|
||||
unsigned int attack_priority; //!< ???
|
||||
bool isSmashable; //!< Whether or not the object is smashable
|
||||
int difficultyLevel; //!< ???
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDDestructibleComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDDestructibleComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDDestructibleComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDDestructibleComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDDestructibleComponent> GetEntries(void) const;
|
||||
|
||||
};
|
44
dDatabase/Tables/CDEmoteTable.cpp
Normal file
44
dDatabase/Tables/CDEmoteTable.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include "CDEmoteTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDEmoteTableTable::CDEmoteTableTable(void) {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
||||
while (!tableData.eof()) {
|
||||
CDEmoteTable* entry = new CDEmoteTable();
|
||||
entry->ID = tableData.getIntField(0, -1);
|
||||
entry->animationName = tableData.getStringField(1, "");
|
||||
entry->iconFilename = tableData.getStringField(2, "");
|
||||
entry->channel = tableData.getIntField(3, -1);
|
||||
entry->locked = tableData.getIntField(5, -1) != 0;
|
||||
entry->localize = tableData.getIntField(6, -1) != 0;
|
||||
entry->locState = tableData.getIntField(7, -1);
|
||||
entry->gateVersion = tableData.getIntField(8, -1);
|
||||
|
||||
entries.insert(std::make_pair(entry->ID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDEmoteTableTable::~CDEmoteTableTable(void) {
|
||||
for (auto e : entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
//! 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;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
56
dDatabase/Tables/CDEmoteTable.h
Normal file
56
dDatabase/Tables/CDEmoteTable.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
|
||||
/*!
|
||||
\file CDEmoteTable.hpp
|
||||
\brief Contains data for the CDEmoteTable table
|
||||
*/
|
||||
|
||||
//! CDEmoteEntry Struct
|
||||
struct CDEmoteTable {
|
||||
CDEmoteTable() {
|
||||
ID = -1;
|
||||
animationName = "";
|
||||
iconFilename = "";
|
||||
locState = -1;
|
||||
channel = -1;
|
||||
locked = false;
|
||||
localize = false;
|
||||
gateVersion = -1;
|
||||
}
|
||||
|
||||
int ID;
|
||||
std::string animationName;
|
||||
std::string iconFilename;
|
||||
int locState;
|
||||
int channel;
|
||||
bool locked;
|
||||
bool localize;
|
||||
int gateVersion;
|
||||
};
|
||||
|
||||
//! CDEmoteTable table
|
||||
class CDEmoteTableTable : public CDTable {
|
||||
private:
|
||||
std::map<int, CDEmoteTable*> entries;
|
||||
|
||||
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
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
};
|
71
dDatabase/Tables/CDFeatureGatingTable.cpp
Normal file
71
dDatabase/Tables/CDFeatureGatingTable.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include "CDFeatureGatingTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDFeatureGatingTable::CDFeatureGatingTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM FeatureGating");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM FeatureGating");
|
||||
while (!tableData.eof()) {
|
||||
CDFeatureGating entry;
|
||||
entry.featureName = tableData.getStringField(0, "");
|
||||
entry.major = tableData.getIntField(1, -1);
|
||||
entry.current = tableData.getIntField(2, -1);
|
||||
entry.minor = tableData.getIntField(3, -1);
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.featureName == feature)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
52
dDatabase/Tables/CDFeatureGatingTable.h
Normal file
52
dDatabase/Tables/CDFeatureGatingTable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
/*!
|
||||
\file CDFeatureGatingTable.hpp
|
||||
*/
|
||||
|
||||
//! ItemComponent Struct
|
||||
struct CDFeatureGating {
|
||||
std::string featureName;
|
||||
int32_t major;
|
||||
int32_t current;
|
||||
int32_t minor;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDFeatureGatingTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDFeatureGating> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDFeatureGatingTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDFeatureGatingTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
|
||||
|
||||
bool FeatureUnlocked(const std::string& feature) const;
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDFeatureGating> GetEntries(void) const;
|
||||
|
||||
};
|
57
dDatabase/Tables/CDInventoryComponentTable.cpp
Normal file
57
dDatabase/Tables/CDInventoryComponentTable.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "CDInventoryComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDInventoryComponentTable::CDInventoryComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM InventoryComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM InventoryComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDInventoryComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(1, -1);
|
||||
entry.count = tableData.getIntField(2, -1);
|
||||
entry.equip = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
50
dDatabase/Tables/CDInventoryComponentTable.h
Normal file
50
dDatabase/Tables/CDInventoryComponentTable.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
unsigned int count; //!< The count of the items the object has
|
||||
bool equip; //!< Whether or not to equip the item
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDInventoryComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDInventoryComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDInventoryComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDInventoryComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDInventoryComponent> GetEntries(void) const;
|
||||
|
||||
};
|
179
dDatabase/Tables/CDItemComponentTable.cpp
Normal file
179
dDatabase/Tables/CDItemComponentTable.cpp
Normal file
@@ -0,0 +1,179 @@
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
CDItemComponent CDItemComponentTable::Default = {};
|
||||
|
||||
//! Constructor
|
||||
CDItemComponentTable::CDItemComponentTable(void) {
|
||||
Default = CDItemComponent();
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
entry.audioEventUse = tableData.getStringField(32, "");
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
entry.audioEquipMetaEventSet = tableData.getStringField(36, "");
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
entry.ingredientInfo = tableData.getStringField(38, "");
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#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()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(skillID);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
if (tableData.eof()) {
|
||||
entries.insert(std::make_pair(skillID, Default));
|
||||
return Default;
|
||||
}
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.equipLocation = tableData.getStringField(1, "");
|
||||
entry.baseValue = tableData.getIntField(2, -1);
|
||||
entry.isKitPiece = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField(4, 0);
|
||||
entry.itemType = tableData.getIntField(5, -1);
|
||||
entry.itemInfo = tableData.getInt64Field(6, -1);
|
||||
entry.inLootTable = tableData.getIntField(7, -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField(8, -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField(10, -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField(12, -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField(13, -1);
|
||||
entry.reqSpecRank = tableData.getIntField(14, -1);
|
||||
entry.reqAchievementID = tableData.getIntField(15, -1);
|
||||
entry.stackSize = tableData.getIntField(16, -1);
|
||||
entry.color1 = tableData.getIntField(17, -1);
|
||||
entry.decal = tableData.getIntField(18, -1);
|
||||
entry.offsetGroupID = tableData.getIntField(19, -1);
|
||||
entry.buildTypes = tableData.getIntField(20, -1);
|
||||
entry.reqPrecondition = tableData.getStringField(21, "");
|
||||
entry.animationFlag = tableData.getIntField(22, -1);
|
||||
entry.equipEffects = tableData.getIntField(23, -1);
|
||||
entry.readyForQA = tableData.getIntField(24, -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField(25, -1);
|
||||
entry.isTwoHanded = tableData.getIntField(26, -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField(27, -1);
|
||||
entry.delResIndex = tableData.getIntField(28, -1);
|
||||
entry.currencyLOT = tableData.getIntField(29, -1);
|
||||
entry.altCurrencyCost = tableData.getIntField(30, -1);
|
||||
entry.subItems = tableData.getStringField(31, "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField(32, ""));
|
||||
entry.noEquipAnimation = tableData.getIntField(33, -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField(34, -1);
|
||||
entry.commendationCost = tableData.getIntField(35, -1);
|
||||
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField(36, ""));
|
||||
entry.currencyCosts = tableData.getStringField(37, "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField(38, ""));
|
||||
entry.locStatus = tableData.getIntField(39, -1);
|
||||
entry.forgeType = tableData.getIntField(40, -1);
|
||||
entry.SellMultiplier = tableData.getFloatField(41, -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
const auto& it2 = this->entries.find(skillID);
|
||||
if (it2 != this->entries.end()) {
|
||||
return it2->second;
|
||||
}
|
||||
#endif
|
||||
|
||||
return Default;
|
||||
}
|
||||
|
||||
std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDItemComponent& itemComponent) {
|
||||
std::map<LOT, uint32_t> currencies = {};
|
||||
|
||||
if (!itemComponent.currencyCosts.empty()) {
|
||||
auto currencySplit = GeneralUtils::SplitString(itemComponent.currencyCosts, ',');
|
||||
for (const auto& currencyAmount : currencySplit) {
|
||||
auto amountSplit = GeneralUtils::SplitString(currencyAmount, ':');
|
||||
|
||||
// Checking for 2 here, not sure what to do when there's more stuff than expected
|
||||
if (amountSplit.size() == 2) {
|
||||
currencies.insert({
|
||||
std::stol(amountSplit[0]),
|
||||
std::stoi(amountSplit[1])
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currencies;
|
||||
}
|
83
dDatabase/Tables/CDItemComponentTable.h
Normal file
83
dDatabase/Tables/CDItemComponentTable.h
Normal file
@@ -0,0 +1,83 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#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
|
||||
unsigned int baseValue; //!< The monetary base value of the item
|
||||
bool isKitPiece; //!< Whether or not the item belongs to a kit
|
||||
unsigned int rarity; //!< The rarity of the item
|
||||
unsigned int itemType; //!< The item type
|
||||
int64_t itemInfo; //!< The item info
|
||||
bool inLootTable; //!< Whether or not the item is in a loot table
|
||||
bool inVendor; //!< Whether or not the item is in a vendor inventory
|
||||
bool isUnique; //!< ???
|
||||
bool isBOP; //!< ???
|
||||
bool isBOE; //!< ???
|
||||
unsigned int reqFlagID; //!< User must have completed this flag to get the item
|
||||
unsigned int reqSpecialtyID; //!< ???
|
||||
unsigned int reqSpecRank; //!< ???
|
||||
unsigned int reqAchievementID; //!< The required achievement must be completed
|
||||
unsigned int stackSize; //!< The stack size of the item
|
||||
unsigned int color1; //!< Something to do with item color...
|
||||
unsigned int decal; //!< The decal of the item
|
||||
unsigned int offsetGroupID; //!< Something to do with group IDs
|
||||
unsigned int buildTypes; //!< Something to do with building
|
||||
std::string reqPrecondition; //!< The required precondition
|
||||
unsigned int animationFlag; //!< The Animation Flag
|
||||
unsigned int equipEffects; //!< The effect played when the item is equipped
|
||||
bool readyForQA; //!< ???
|
||||
unsigned int itemRating; //!< ???
|
||||
bool isTwoHanded; //!< Whether or not the item is double handed
|
||||
unsigned int minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
|
||||
unsigned int delResIndex; //!< ???
|
||||
unsigned int currencyLOT; //!< ???
|
||||
unsigned int altCurrencyCost; //!< ???
|
||||
std::string subItems; //!< A comma seperate string of sub items (maybe for multi-itemed things like faction test gear set)
|
||||
UNUSED(std::string audioEventUse); //!< ???
|
||||
bool noEquipAnimation; //!< Whether or not there is an equip animation
|
||||
unsigned int commendationLOT; //!< The commendation LOT
|
||||
unsigned int commendationCost; //!< The commendation cost
|
||||
UNUSED(std::string audioEquipMetaEventSet); //!< ???
|
||||
std::string currencyCosts; //!< Used for crafting
|
||||
UNUSED(std::string ingredientInfo); //!< Unused
|
||||
unsigned int locStatus; //!< ???
|
||||
unsigned int forgeType; //!< Forge Type
|
||||
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
|
||||
};
|
||||
|
||||
//! ItemComponent table
|
||||
class CDItemComponentTable : public CDTable {
|
||||
private:
|
||||
std::map<unsigned int, CDItemComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDItemComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDItemComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
|
||||
|
||||
static CDItemComponent Default;
|
||||
};
|
68
dDatabase/Tables/CDItemSetSkillsTable.cpp
Normal file
68
dDatabase/Tables/CDItemSetSkillsTable.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include "CDItemSetSkillsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSetSkills");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSetSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSetSkills entry;
|
||||
entry.SkillSetID = tableData.getIntField(0, -1);
|
||||
entry.SkillID = tableData.getIntField(1, -1);
|
||||
entry.SkillCastType = tableData.getIntField(2, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(unsigned int SkillSetID)
|
||||
{
|
||||
std::vector<CDItemSetSkills> toReturn;
|
||||
|
||||
for (CDItemSetSkills entry : this->entries) {
|
||||
if (entry.SkillSetID == SkillSetID) toReturn.push_back(entry);
|
||||
if (entry.SkillSetID > SkillSetID) return toReturn; //stop seeking in the db if it's not needed.
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
52
dDatabase/Tables/CDItemSetSkillsTable.h
Normal file
52
dDatabase/Tables/CDItemSetSkillsTable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// 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 {
|
||||
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
|
||||
*/
|
||||
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);
|
||||
|
||||
};
|
||||
|
68
dDatabase/Tables/CDItemSetsTable.cpp
Normal file
68
dDatabase/Tables/CDItemSetsTable.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
#include "CDItemSetsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDItemSetsTable::CDItemSetsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ItemSets");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ItemSets");
|
||||
while (!tableData.eof()) {
|
||||
CDItemSets entry;
|
||||
entry.setID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.itemIDs = tableData.getStringField(2, "");
|
||||
entry.kitType = tableData.getIntField(3, -1);
|
||||
entry.kitRank = tableData.getIntField(4, -1);
|
||||
entry.kitImage = tableData.getIntField(5, -1);
|
||||
entry.skillSetWith2 = tableData.getIntField(6, -1);
|
||||
entry.skillSetWith3 = tableData.getIntField(7, -1);
|
||||
entry.skillSetWith4 = tableData.getIntField(8, -1);
|
||||
entry.skillSetWith5 = tableData.getIntField(9, -1);
|
||||
entry.skillSetWith6 = tableData.getIntField(10, -1);
|
||||
entry.localize = tableData.getIntField(11, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.kitID = tableData.getIntField(13, -1);
|
||||
entry.priority = tableData.getFloatField(14, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
62
dDatabase/Tables/CDItemSetsTable.h
Normal file
62
dDatabase/Tables/CDItemSetsTable.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
std::string itemIDs; //!< THe item IDs
|
||||
unsigned int kitType; //!< The item kit type
|
||||
unsigned int kitRank; //!< The item kit rank
|
||||
unsigned int kitImage; //!< The item kit image
|
||||
unsigned int skillSetWith2; //!< The skill set with 2
|
||||
unsigned int skillSetWith3; //!< The skill set with 3
|
||||
unsigned int skillSetWith4; //!< The skill set with 4
|
||||
unsigned int skillSetWith5; //!< The skill set with 5
|
||||
unsigned int skillSetWith6; //!< The skill set with 6
|
||||
bool localize; //!< Whether or localize
|
||||
std::string gate_version; //!< The gate version
|
||||
unsigned int kitID; //!< The kit ID
|
||||
float priority; //!< The priority
|
||||
};
|
||||
|
||||
//! ItemSets table
|
||||
class CDItemSetsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDItemSets> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDItemSetsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDItemSetsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDItemSets> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
56
dDatabase/Tables/CDLevelProgressionLookupTable.cpp
Normal file
56
dDatabase/Tables/CDLevelProgressionLookupTable.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "CDLevelProgressionLookupTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LevelProgressionLookup");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LevelProgressionLookup");
|
||||
while (!tableData.eof()) {
|
||||
CDLevelProgressionLookup entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.requiredUScore = tableData.getIntField(1, -1);
|
||||
entry.BehaviorEffect = tableData.getStringField(2, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDLevelProgressionLookup> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
49
dDatabase/Tables/CDLevelProgressionLookupTable.h
Normal file
49
dDatabase/Tables/CDLevelProgressionLookupTable.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
// 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 {
|
||||
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
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDLevelProgressionLookup> GetEntries(void) const;
|
||||
|
||||
};
|
62
dDatabase/Tables/CDLootMatrixTable.cpp
Normal file
62
dDatabase/Tables/CDLootMatrixTable.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#include "CDLootMatrixTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDLootMatrixTable::CDLootMatrixTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootMatrix");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
|
||||
while (!tableData.eof()) {
|
||||
CDLootMatrix entry;
|
||||
entry.LootMatrixIndex = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(2, -1);
|
||||
entry.percent = tableData.getFloatField(3, -1.0f);
|
||||
entry.minToDrop = tableData.getIntField(4, -1);
|
||||
entry.maxToDrop = tableData.getIntField(5, -1);
|
||||
entry.id = tableData.getIntField(6, -1);
|
||||
entry.flagID = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(8, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDLootMatrix> CDLootMatrixTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
56
dDatabase/Tables/CDLootMatrixTable.h
Normal file
56
dDatabase/Tables/CDLootMatrixTable.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
unsigned int RarityTableIndex; //!< The Rarity Table Index
|
||||
float percent; //!< The percent that this matrix is used?
|
||||
unsigned int minToDrop; //!< The minimum amount of loot from this matrix to drop
|
||||
unsigned int maxToDrop; //!< The maximum amount of loot from this matrix to drop
|
||||
unsigned int id; //!< The ID of the Loot Matrix
|
||||
unsigned int flagID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDLootMatrixTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDLootMatrix> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDLootMatrixTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDLootMatrixTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDLootMatrix> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
59
dDatabase/Tables/CDLootTableTable.cpp
Normal file
59
dDatabase/Tables/CDLootTableTable.cpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#include "CDLootTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDLootTableTable::CDLootTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
|
||||
while (!tableData.eof()) {
|
||||
CDLootTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.itemid = tableData.getIntField(0, -1);
|
||||
entry.LootTableIndex = tableData.getIntField(1, -1);
|
||||
entry.id = tableData.getIntField(2, -1);
|
||||
entry.MissionDrop = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.sortPriority = tableData.getIntField(4, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDLootTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDLootTable> CDLootTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
52
dDatabase/Tables/CDLootTableTable.h
Normal file
52
dDatabase/Tables/CDLootTableTable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
unsigned int id; //!< The ID
|
||||
bool MissionDrop; //!< Whether or not this loot table is a mission drop
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
};
|
||||
|
||||
//! LootTable table
|
||||
class CDLootTableTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDLootTable> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDLootTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDLootTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDLootTable> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
61
dDatabase/Tables/CDMissionEmailTable.cpp
Normal file
61
dDatabase/Tables/CDMissionEmailTable.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "CDMissionEmailTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDMissionEmailTable::CDMissionEmailTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionEmail");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionEmail");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionEmail entry;
|
||||
entry.ID = tableData.getIntField(0, -1);
|
||||
entry.messageType = tableData.getIntField(1, -1);
|
||||
entry.notificationGroup = tableData.getIntField(2, -1);
|
||||
entry.missionID = tableData.getIntField(3, -1);
|
||||
entry.attachmentLOT = tableData.getIntField(4, 0);
|
||||
entry.localize = (bool)tableData.getIntField(5, -1);
|
||||
entry.locStatus = tableData.getIntField(6, -1);
|
||||
entry.gate_version = tableData.getStringField(7, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDMissionEmail> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
55
dDatabase/Tables/CDMissionEmailTable.h
Normal file
55
dDatabase/Tables/CDMissionEmailTable.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
// 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;
|
||||
unsigned int notificationGroup;
|
||||
unsigned int missionID;
|
||||
unsigned int attachmentLOT;
|
||||
bool localize;
|
||||
unsigned int locStatus;
|
||||
std::string gate_version;
|
||||
};
|
||||
|
||||
|
||||
//! MissionEmail table
|
||||
class CDMissionEmailTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissionEmail> entries;
|
||||
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
58
dDatabase/Tables/CDMissionNPCComponentTable.cpp
Normal file
58
dDatabase/Tables/CDMissionNPCComponentTable.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionNPCComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionNPCComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionNPCComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.missionID = tableData.getIntField(1, -1);
|
||||
entry.offersMission = tableData.getIntField(2, -1) == 1 ? true : false;
|
||||
entry.acceptsMission = tableData.getIntField(3, -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField(4, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDMissionNPCComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
52
dDatabase/Tables/CDMissionNPCComponentTable.h
Normal file
52
dDatabase/Tables/CDMissionNPCComponentTable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
bool offersMission; //!< Whether or not this NPC offers a mission
|
||||
bool acceptsMission; //!< Whether or not this NPC accepts a mission
|
||||
std::string gate_version; //!< The gate version
|
||||
};
|
||||
|
||||
//! MissionNPCComponent table
|
||||
class CDMissionNPCComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissionNPCComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionNPCComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionNPCComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMissionNPCComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
83
dDatabase/Tables/CDMissionTasksTable.cpp
Normal file
83
dDatabase/Tables/CDMissionTasksTable.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "CDMissionTasksTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDMissionTasksTable::CDMissionTasksTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MissionTasks");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM MissionTasks");
|
||||
while (!tableData.eof()) {
|
||||
CDMissionTasks entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.taskType = tableData.getIntField(2, -1);
|
||||
entry.target = tableData.getIntField(3, -1);
|
||||
entry.targetGroup = tableData.getStringField(4, "");
|
||||
entry.targetValue = tableData.getIntField(5, -1);
|
||||
entry.taskParam1 = tableData.getStringField(6, "");
|
||||
UNUSED(entry.largeTaskIcon = tableData.getStringField(7, ""));
|
||||
UNUSED(entry.IconID = tableData.getIntField(8, -1));
|
||||
entry.uid = tableData.getIntField(9, -1);
|
||||
UNUSED(entry.largeTaskIconID = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.localize = tableData.getIntField(11, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missionID)
|
||||
{
|
||||
std::vector<CDMissionTasks*> tasks;
|
||||
|
||||
for (auto& entry : this->entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
CDMissionTasks* task = const_cast<CDMissionTasks*>(&entry);
|
||||
|
||||
tasks.push_back(task);
|
||||
}
|
||||
}
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
61
dDatabase/Tables/CDMissionTasksTable.h
Normal file
61
dDatabase/Tables/CDMissionTasksTable.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
// 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); //!< ???
|
||||
unsigned int taskType; //!< The task type
|
||||
unsigned int target; //!< The mission target
|
||||
std::string targetGroup; //!< The mission target group
|
||||
int targetValue; //!< The target value
|
||||
std::string taskParam1; //!< The task param 1
|
||||
UNUSED(std::string largeTaskIcon); //!< ???
|
||||
UNUSED(unsigned int IconID); //!< ???
|
||||
unsigned int uid; //!< ???
|
||||
UNUSED(unsigned int largeTaskIconID); //!< ???
|
||||
UNUSED(bool localize); //!< Whether or not the task should be localized
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDMissionTasksTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissionTasks> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionTasksTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionTasksTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
|
||||
|
||||
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissionTasks>& GetEntries(void) const;
|
||||
};
|
||||
|
139
dDatabase/Tables/CDMissionsTable.cpp
Normal file
139
dDatabase/Tables/CDMissionsTable.cpp
Normal file
@@ -0,0 +1,139 @@
|
||||
#include "CDMissionsTable.h"
|
||||
|
||||
CDMissions CDMissionsTable::Default = {};
|
||||
|
||||
//! Constructor
|
||||
CDMissionsTable::CDMissionsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Missions");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Missions");
|
||||
while (!tableData.eof()) {
|
||||
CDMissions entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.defined_type = tableData.getStringField(1, "");
|
||||
entry.defined_subtype = tableData.getStringField(2, "");
|
||||
entry.UISortOrder = tableData.getIntField(3, -1);
|
||||
entry.offer_objectID = tableData.getIntField(4, -1);
|
||||
entry.target_objectID = tableData.getIntField(5, -1);
|
||||
entry.reward_currency = tableData.getInt64Field(6, -1);
|
||||
entry.LegoScore = tableData.getIntField(7, -1);
|
||||
entry.reward_reputation = tableData.getIntField(8, -1);
|
||||
entry.isChoiceReward = tableData.getIntField(9, -1) == 1 ? true : false;
|
||||
entry.reward_item1 = tableData.getIntField(10, 0);
|
||||
entry.reward_item1_count = tableData.getIntField(11, 0);
|
||||
entry.reward_item2 = tableData.getIntField(12, 0);
|
||||
entry.reward_item2_count = tableData.getIntField(13, 0);
|
||||
entry.reward_item3 = tableData.getIntField(14, 0);
|
||||
entry.reward_item3_count = tableData.getIntField(15, 0);
|
||||
entry.reward_item4 = tableData.getIntField(16, 0);
|
||||
entry.reward_item4_count = tableData.getIntField(17, 0);
|
||||
entry.reward_emote = tableData.getIntField(18, -1);
|
||||
entry.reward_emote2 = tableData.getIntField(19, -1);
|
||||
entry.reward_emote3 = tableData.getIntField(20, -1);
|
||||
entry.reward_emote4 = tableData.getIntField(21, -1);
|
||||
entry.reward_maximagination = tableData.getIntField(22, -1);
|
||||
entry.reward_maxhealth = tableData.getIntField(23, -1);
|
||||
entry.reward_maxinventory = tableData.getIntField(24, -1);
|
||||
entry.reward_maxmodel = tableData.getIntField(25, -1);
|
||||
entry.reward_maxwidget = tableData.getIntField(26, -1);
|
||||
entry.reward_maxwallet = tableData.getIntField(27, -1);
|
||||
entry.repeatable = tableData.getIntField(28, -1) == 1 ? true : false;
|
||||
entry.reward_currency_repeatable = tableData.getIntField(29, -1);
|
||||
entry.reward_item1_repeatable = tableData.getIntField(30, -1);
|
||||
entry.reward_item1_repeat_count = tableData.getIntField(31, -1);
|
||||
entry.reward_item2_repeatable = tableData.getIntField(32, -1);
|
||||
entry.reward_item2_repeat_count = tableData.getIntField(33, -1);
|
||||
entry.reward_item3_repeatable = tableData.getIntField(34, -1);
|
||||
entry.reward_item3_repeat_count = tableData.getIntField(34, -1);
|
||||
entry.reward_item4_repeatable = tableData.getIntField(36, -1);
|
||||
entry.reward_item4_repeat_count = tableData.getIntField(37, -1);
|
||||
entry.time_limit = tableData.getIntField(38, -1);
|
||||
entry.isMission = tableData.getIntField(39, -1) ? true : false;
|
||||
entry.missionIconID = tableData.getIntField(40, -1);
|
||||
entry.prereqMissionID = tableData.getStringField(41, "");
|
||||
entry.localize = tableData.getIntField(42, -1) == 1 ? true : false;
|
||||
entry.inMOTD = tableData.getIntField(43, -1) == 1 ? true : false;
|
||||
entry.cooldownTime = tableData.getInt64Field(44, -1);
|
||||
entry.isRandom = tableData.getIntField(45, -1) == 1 ? true : false;
|
||||
entry.randomPool = tableData.getStringField(46, "");
|
||||
entry.UIPrereqID = tableData.getIntField(47, -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(48, ""));
|
||||
UNUSED(entry.HUDStates = tableData.getStringField(49, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(50, -1));
|
||||
entry.reward_bankinventory = tableData.getIntField(51, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
Default.id = -1;
|
||||
}
|
||||
|
||||
//! 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)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
const CDMissions* CDMissionsTable::GetPtrByMissionID(uint32_t missionID) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
return const_cast<CDMissions*>(&entry);
|
||||
}
|
||||
}
|
||||
|
||||
return &Default;
|
||||
}
|
||||
|
||||
const CDMissions& CDMissionsTable::GetByMissionID(uint32_t missionID, bool& found) const
|
||||
{
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
if (entry.id == missionID)
|
||||
{
|
||||
found = true;
|
||||
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
found = false;
|
||||
|
||||
return Default;
|
||||
}
|
105
dDatabase/Tables/CDMissionsTable.h
Normal file
105
dDatabase/Tables/CDMissionsTable.h
Normal file
@@ -0,0 +1,105 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
|
||||
/*!
|
||||
\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
|
||||
std::string defined_subtype; //!< The subtype of the mission
|
||||
int UISortOrder; //!< The UI Sort Order for the mission
|
||||
int offer_objectID; //!< The LOT of the mission giver
|
||||
int target_objectID; //!< The LOT of the mission's target
|
||||
__int64 reward_currency; //!< The amount of currency to reward the player
|
||||
int LegoScore; //!< The amount of LEGO Score to reward the player
|
||||
__int64 reward_reputation; //!< The reputation to award the player
|
||||
bool isChoiceReward; //!< Whether or not the user has the option to choose their loot
|
||||
int reward_item1; //!< The first rewarded item
|
||||
int reward_item1_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2; //!< The second rewarded item
|
||||
int reward_item2_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3; //!< The third rewarded item
|
||||
int reward_item3_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4; //!< The fourth rewarded item
|
||||
int reward_item4_count; //!< The count of the fourth item to be rewarded
|
||||
int reward_emote; //!< The first emote to be rewarded
|
||||
int reward_emote2; //!< The second emote to be rewarded
|
||||
int reward_emote3; //!< The third emote to be rewarded
|
||||
int reward_emote4; //!< The fourth emote to be rewarded
|
||||
int reward_maximagination; //!< The amount of max imagination to reward
|
||||
int reward_maxhealth; //!< The amount of max health to reward
|
||||
int reward_maxinventory; //!< The amount of max inventory to reward
|
||||
int reward_maxmodel; //!< ???
|
||||
int reward_maxwidget; //!< ???
|
||||
int reward_maxwallet; //!< ???
|
||||
bool repeatable; //!< Whether or not this mission can be repeated (for instance, is it a daily mission)
|
||||
__int64 reward_currency_repeatable; //!< The repeatable reward
|
||||
int reward_item1_repeatable; //!< The first rewarded item
|
||||
int reward_item1_repeat_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2_repeatable; //!< The second rewarded item
|
||||
int reward_item2_repeat_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3_repeatable; //!< The third rewarded item
|
||||
int reward_item3_repeat_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4_repeatable; //!< The fourth rewarded item
|
||||
int reward_item4_repeat_count; //!< The count of the fourth item to be rewarded
|
||||
int time_limit; //!< The time limit of the mission
|
||||
bool isMission; //!< Maybe to differentiate between missions and achievements?
|
||||
int missionIconID; //!< The mission icon ID
|
||||
std::string prereqMissionID; //!< A '|' seperated list of prerequisite missions
|
||||
bool localize; //!< Whether or not to localize the mission
|
||||
bool inMOTD; //!< In Match of the Day(?)
|
||||
__int64 cooldownTime; //!< The mission cooldown time
|
||||
bool isRandom; //!< ???
|
||||
std::string randomPool; //!< ???
|
||||
int UIPrereqID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(std::string HUDStates); //!< ???
|
||||
UNUSED(int locStatus); //!< ???
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
//! Missions table
|
||||
class CDMissionsTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDMissions> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDMissionsTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDMissionsTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
const std::vector<CDMissions>& GetEntries(void) const;
|
||||
|
||||
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
|
||||
|
||||
const CDMissions& GetByMissionID(uint32_t missionID, bool& found) const;
|
||||
|
||||
static CDMissions Default;
|
||||
};
|
||||
|
61
dDatabase/Tables/CDMovementAIComponentTable.cpp
Normal file
61
dDatabase/Tables/CDMovementAIComponentTable.cpp
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "CDMovementAIComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM MovementAIComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
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, "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDMovementAIComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
55
dDatabase/Tables/CDMovementAIComponentTable.h
Normal file
55
dDatabase/Tables/CDMovementAIComponentTable.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
// 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;
|
||||
float WanderChance;
|
||||
float WanderDelayMin;
|
||||
float WanderDelayMax;
|
||||
float WanderSpeed;
|
||||
float WanderRadius;
|
||||
std::string attachedPath;
|
||||
};
|
||||
|
||||
//! MovementAIComponent table
|
||||
class CDMovementAIComponentTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDMovementAIComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
57
dDatabase/Tables/CDObjectSkillsTable.cpp
Normal file
57
dDatabase/Tables/CDObjectSkillsTable.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "CDObjectSkillsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDObjectSkillsTable::CDObjectSkillsTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ObjectSkills");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ObjectSkills");
|
||||
while (!tableData.eof()) {
|
||||
CDObjectSkills entry;
|
||||
entry.objectTemplate = tableData.getIntField(0, -1);
|
||||
entry.skillID = tableData.getIntField(1, -1);
|
||||
entry.castOnType = tableData.getIntField(2, -1);
|
||||
entry.AICombatWeight = tableData.getIntField(3, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDObjectSkills> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDObjectSkills> CDObjectSkillsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
51
dDatabase/Tables/CDObjectSkillsTable.h
Normal file
51
dDatabase/Tables/CDObjectSkillsTable.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
unsigned int castOnType; //!< ???
|
||||
unsigned int AICombatWeight; //!< ???
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectSkillsTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDObjectSkills> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
102
dDatabase/Tables/CDObjectsTable.cpp
Normal file
102
dDatabase/Tables/CDObjectsTable.cpp
Normal file
@@ -0,0 +1,102 @@
|
||||
#include "CDObjectsTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDObjectsTable::CDObjectsTable(void) {
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Objects");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Objects");
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
entry.placeable = tableData.getIntField(2, -1);
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
entry.description = tableData.getStringField(4, "");
|
||||
entry.localize = tableData.getIntField(5, -1);
|
||||
entry.npcTemplateID = tableData.getIntField(6, -1);
|
||||
entry.displayName = tableData.getStringField(7, "");
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
entry.nametag = tableData.getIntField(9, -1);
|
||||
entry._internalNotes = tableData.getStringField(10, "");
|
||||
entry.locStatus = tableData.getIntField(11, -1);
|
||||
entry.gate_version = tableData.getStringField(12, "");
|
||||
entry.HQ_valid = tableData.getIntField(13, -1);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
|
||||
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()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM Objects WHERE id = " << std::to_string(LOT);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
if (tableData.eof()) {
|
||||
this->entries.insert(std::make_pair(LOT, m_default));
|
||||
return m_default;
|
||||
}
|
||||
|
||||
// Now get the data
|
||||
while (!tableData.eof()) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.name = tableData.getStringField(1, "");
|
||||
UNUSED(entry.placeable = tableData.getIntField(2, -1));
|
||||
entry.type = tableData.getStringField(3, "");
|
||||
UNUSED(ntry.description = tableData.getStringField(4, ""));
|
||||
UNUSED(entry.localize = tableData.getIntField(5, -1));
|
||||
UNUSED(entry.npcTemplateID = tableData.getIntField(6, -1));
|
||||
UNUSED(entry.displayName = tableData.getStringField(7, ""));
|
||||
entry.interactionDistance = tableData.getFloatField(8, -1.0f);
|
||||
UNUSED(entry.nametag = tableData.getIntField(9, -1));
|
||||
UNUSED(entry._internalNotes = tableData.getStringField(10, ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.gate_version = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.HQ_valid = tableData.getIntField(13, -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
const auto& it2 = entries.find(LOT);
|
||||
if (it2 != entries.end()) {
|
||||
return it2->second;
|
||||
}
|
||||
#endif
|
||||
|
||||
return m_default;
|
||||
}
|
54
dDatabase/Tables/CDObjectsTable.h
Normal file
54
dDatabase/Tables/CDObjectsTable.h
Normal file
@@ -0,0 +1,54 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
UNUSED(unsigned int placeable); //!< Whether or not the object is placable
|
||||
std::string type; //!< The object type
|
||||
UNUSED(std::string description); //!< An internal description of the object
|
||||
UNUSED(unsigned int localize); //!< Whether or not the object should localize
|
||||
UNUSED(unsigned int npcTemplateID); //!< Something related to NPCs...
|
||||
UNUSED(std::string displayName); //!< The display name of the object
|
||||
float interactionDistance; //!< The interaction distance of the object
|
||||
UNUSED(unsigned int nametag); //!< ???
|
||||
UNUSED(std::string _internalNotes); //!< Some internal notes (rarely used)
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version for the object
|
||||
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDObjectsTable : public CDTable {
|
||||
private:
|
||||
//std::vector<CDObjects> entries;
|
||||
std::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
|
||||
const CDObjects& GetByID(unsigned int LOT);
|
||||
|
||||
};
|
||||
|
56
dDatabase/Tables/CDPackageComponentTable.cpp
Normal file
56
dDatabase/Tables/CDPackageComponentTable.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "CDPackageComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDPackageComponentTable::CDPackageComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PackageComponent");
|
||||
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 PackageComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDPackageComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField(1, -1);
|
||||
entry.packageType = tableData.getIntField(2, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDPackageComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDPackageComponent> CDPackageComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
50
dDatabase/Tables/CDPackageComponentTable.h
Normal file
50
dDatabase/Tables/CDPackageComponentTable.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
// 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 {
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
49
dDatabase/Tables/CDPhysicsComponentTable.cpp
Normal file
49
dDatabase/Tables/CDPhysicsComponentTable.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
|
||||
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));
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
34
dDatabase/Tables/CDPhysicsComponentTable.h
Normal file
34
dDatabase/Tables/CDPhysicsComponentTable.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
#include <string>
|
||||
|
||||
struct CDPhysicsComponent {
|
||||
int id;
|
||||
bool bStatic;
|
||||
std::string physicsAsset;
|
||||
UNUSED(bool jump);
|
||||
UNUSED(bool doublejump);
|
||||
float speed;
|
||||
UNUSED(float rotSpeed);
|
||||
float playerHeight;
|
||||
float playerRadius;
|
||||
int pcShapeType;
|
||||
int collisionGroup;
|
||||
UNUSED(float airSpeed);
|
||||
UNUSED(std::string boundaryAsset);
|
||||
UNUSED(float jumpAirSpeed);
|
||||
UNUSED(float friction);
|
||||
UNUSED(std::string gravityVolumeAsset);
|
||||
};
|
||||
|
||||
class CDPhysicsComponentTable : public CDTable {
|
||||
public:
|
||||
CDPhysicsComponentTable(void);
|
||||
~CDPhysicsComponentTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
CDPhysicsComponent* GetByID(unsigned int componentID);
|
||||
|
||||
private:
|
||||
std::map<unsigned int, CDPhysicsComponent*> m_entries;
|
||||
};
|
48
dDatabase/Tables/CDPropertyEntranceComponentTable.cpp
Normal file
48
dDatabase/Tables/CDPropertyEntranceComponentTable.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
|
||||
#include "CDPropertyEntranceComponentTable.h"
|
||||
|
||||
CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
|
||||
|
||||
// First, get the size of the table
|
||||
size_t size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyEntranceComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyEntranceComponent;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyEntranceComponent {
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
tableData.getStringField(2, ""),
|
||||
static_cast<bool>(tableData.getIntField(3, false)),
|
||||
tableData.getStringField(4, "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
}
|
41
dDatabase/Tables/CDPropertyEntranceComponentTable.h
Normal file
41
dDatabase/Tables/CDPropertyEntranceComponentTable.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyEntranceComponent {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
std::string propertyName;
|
||||
bool isOnProperty;
|
||||
std::string groupType;
|
||||
};
|
||||
|
||||
class CDPropertyEntranceComponentTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
|
||||
private:
|
||||
std::vector<CDPropertyEntranceComponent> entries {};
|
||||
CDPropertyEntranceComponent defaultEntry {};
|
||||
};
|
46
dDatabase/Tables/CDPropertyTemplateTable.cpp
Normal file
46
dDatabase/Tables/CDPropertyTemplateTable.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "CDPropertyTemplateTable.h"
|
||||
|
||||
CDPropertyTemplateTable::CDPropertyTemplateTable() {
|
||||
|
||||
// First, get the size of the table
|
||||
size_t size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyTemplate;");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyTemplate;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyTemplate {
|
||||
static_cast<uint32_t>(tableData.getIntField(0, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(1, -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField(2, -1)),
|
||||
tableData.getStringField(3, "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
}
|
21
dDatabase/Tables/CDPropertyTemplateTable.h
Normal file
21
dDatabase/Tables/CDPropertyTemplateTable.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyTemplate {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
uint32_t vendorMapID;
|
||||
std::string spawnName;
|
||||
};
|
||||
|
||||
class CDPropertyTemplateTable : public CDTable {
|
||||
public:
|
||||
CDPropertyTemplateTable();
|
||||
~CDPropertyTemplateTable();
|
||||
|
||||
[[nodiscard]] std::string GetName() const override;
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
private:
|
||||
std::vector<CDPropertyTemplate> entries {};
|
||||
CDPropertyTemplate defaultEntry {};
|
||||
};
|
57
dDatabase/Tables/CDProximityMonitorComponentTable.cpp
Normal file
57
dDatabase/Tables/CDProximityMonitorComponentTable.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "CDProximityMonitorComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ProximityMonitorComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
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);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDProximityMonitorComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
51
dDatabase/Tables/CDProximityMonitorComponentTable.h
Normal file
51
dDatabase/Tables/CDProximityMonitorComponentTable.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
// 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;
|
||||
bool LoadOnClient;
|
||||
bool LoadOnServer;
|
||||
};
|
||||
|
||||
|
||||
//! ProximityMonitorComponent table
|
||||
class CDProximityMonitorComponentTable : public CDTable {
|
||||
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;
|
||||
|
||||
};
|
83
dDatabase/Tables/CDRailActivatorComponent.cpp
Normal file
83
dDatabase/Tables/CDRailActivatorComponent.cpp
Normal file
@@ -0,0 +1,83 @@
|
||||
#include "CDRailActivatorComponent.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RailActivatorComponent;");
|
||||
while (!tableData.eof()) {
|
||||
CDRailActivatorComponent entry;
|
||||
|
||||
entry.id = tableData.getIntField(0);
|
||||
|
||||
std::string startAnimation(tableData.getStringField(1, ""));
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(startAnimation);
|
||||
|
||||
std::string loopAnimation(tableData.getStringField(2, ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(loopAnimation);
|
||||
|
||||
std::string stopAnimation(tableData.getStringField(3, ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(stopAnimation);
|
||||
|
||||
std::string startSound(tableData.getStringField(4, ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(startSound);
|
||||
|
||||
std::string loopSound(tableData.getStringField(5, ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(loopSound);
|
||||
|
||||
std::string stopSound(tableData.getStringField(6, ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(stopSound);
|
||||
|
||||
std::string loopEffectString(tableData.getStringField(7, ""));
|
||||
entry.loopEffectID = EffectPairFromString(loopEffectString);
|
||||
|
||||
entry.preconditions = tableData.getStringField(8, "-1");
|
||||
|
||||
entry.playerCollision = tableData.getIntField(9, 0);
|
||||
|
||||
entry.cameraLocked = tableData.getIntField(10, 0);
|
||||
|
||||
std::string startEffectString(tableData.getStringField(11, ""));
|
||||
entry.startEffectID = EffectPairFromString(startEffectString);
|
||||
|
||||
std::string stopEffectString(tableData.getStringField(12, ""));
|
||||
entry.stopEffectID = EffectPairFromString(stopEffectString);
|
||||
|
||||
entry.damageImmune = tableData.getIntField(13, 0);
|
||||
|
||||
entry.noAggro = tableData.getIntField(14, 0);
|
||||
|
||||
entry.showNameBillboard = tableData.getIntField(15, 0);
|
||||
|
||||
m_Entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<CDRailActivatorComponent> CDRailActivatorComponentTable::GetEntries() const {
|
||||
return m_Entries;
|
||||
}
|
||||
|
||||
std::pair<uint32_t, std::u16string> CDRailActivatorComponentTable::EffectPairFromString(std::string &str) {
|
||||
const auto split = GeneralUtils::SplitString(str, ':');
|
||||
if (split.size() == 2) {
|
||||
return { std::stoi(split.at(0)), GeneralUtils::ASCIIToUTF16(split.at(1)) };
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
34
dDatabase/Tables/CDRailActivatorComponent.h
Normal file
34
dDatabase/Tables/CDRailActivatorComponent.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDRailActivatorComponent {
|
||||
int32_t id;
|
||||
std::u16string startAnimation;
|
||||
std::u16string loopAnimation;
|
||||
std::u16string stopAnimation;
|
||||
std::u16string startSound;
|
||||
std::u16string loopSound;
|
||||
std::u16string stopSound;
|
||||
std::pair<uint32_t, std::u16string> startEffectID;
|
||||
std::pair<uint32_t, std::u16string> loopEffectID;
|
||||
std::pair<uint32_t, std::u16string> stopEffectID;
|
||||
std::string preconditions;
|
||||
bool playerCollision;
|
||||
bool cameraLocked;
|
||||
bool damageImmune;
|
||||
bool noAggro;
|
||||
bool showNameBillboard;
|
||||
};
|
||||
|
||||
class CDRailActivatorComponentTable : public CDTable {
|
||||
public:
|
||||
CDRailActivatorComponentTable();
|
||||
~CDRailActivatorComponentTable();
|
||||
|
||||
std::string GetName() const override;
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
|
||||
private:
|
||||
static std::pair<uint32_t , std::u16string> EffectPairFromString(std::string& str);
|
||||
std::vector<CDRailActivatorComponent> m_Entries {};
|
||||
};
|
57
dDatabase/Tables/CDRarityTableTable.cpp
Normal file
57
dDatabase/Tables/CDRarityTableTable.cpp
Normal file
@@ -0,0 +1,57 @@
|
||||
#include "CDRarityTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDRarityTableTable::CDRarityTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RarityTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RarityTable");
|
||||
while (!tableData.eof()) {
|
||||
CDRarityTable entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.randmax = tableData.getFloatField(1, -1);
|
||||
entry.rarity = tableData.getIntField(2, -1);
|
||||
entry.RarityTableIndex = tableData.getIntField(3, -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDRarityTable> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDRarityTable> CDRarityTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
72
dDatabase/Tables/CDRarityTableTable.h
Normal file
72
dDatabase/Tables/CDRarityTableTable.h
Normal file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
// 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;
|
||||
unsigned int rarity;
|
||||
unsigned int RarityTableIndex;
|
||||
|
||||
friend bool operator> (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity > c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator>= (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity >= c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator< (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity < c2.rarity;
|
||||
}
|
||||
|
||||
friend bool operator<= (const CDRarityTable& c1, const CDRarityTable& c2)
|
||||
{
|
||||
return c1.rarity <= c2.rarity;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! RarityTable table
|
||||
class CDRarityTableTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDRarityTable> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
63
dDatabase/Tables/CDRebuildComponentTable.cpp
Normal file
63
dDatabase/Tables/CDRebuildComponentTable.cpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "CDRebuildComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDRebuildComponentTable::CDRebuildComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM RebuildComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RebuildComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDRebuildComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.reset_time = tableData.getFloatField(1, -1.0f);
|
||||
entry.complete_time = tableData.getFloatField(2, -1.0f);
|
||||
entry.take_imagination = tableData.getIntField(3, -1);
|
||||
entry.interruptible = tableData.getIntField(4, -1) == 1 ? true : false;
|
||||
entry.self_activator = tableData.getIntField(5, -1) == 1 ? true : false;
|
||||
entry.custom_modules = tableData.getStringField(6, "");
|
||||
entry.activityID = tableData.getIntField(7, -1);
|
||||
entry.post_imagination_cost = tableData.getIntField(8, -1);
|
||||
entry.time_before_smash = tableData.getFloatField(9, -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDRebuildComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDRebuildComponent> CDRebuildComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
57
dDatabase/Tables/CDRebuildComponentTable.h
Normal file
57
dDatabase/Tables/CDRebuildComponentTable.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
// 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
|
||||
float complete_time; //!< The complete time
|
||||
unsigned int take_imagination; //!< The amount of imagination it costs
|
||||
bool interruptible; //!< Whether or not the rebuild is interruptible
|
||||
bool self_activator; //!< Whether or not the rebuild is a rebuild activator itself
|
||||
std::string custom_modules; //!< The custom modules
|
||||
unsigned int activityID; //!< The activity ID
|
||||
unsigned int post_imagination_cost; //!< The post imagination cost
|
||||
float time_before_smash; //!< The time before smash
|
||||
};
|
||||
|
||||
//! ObjectSkills table
|
||||
class CDRebuildComponentTable : public CDTable {
|
||||
private:
|
||||
std::vector<CDRebuildComponent> entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDRebuildComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDRebuildComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
|
||||
|
||||
//! Gets all the entries in the table
|
||||
/*!
|
||||
\return The entries
|
||||
*/
|
||||
std::vector<CDRebuildComponent> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
40
dDatabase/Tables/CDRewardsTable.cpp
Normal file
40
dDatabase/Tables/CDRewardsTable.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
#include "CDRewardsTable.h"
|
||||
|
||||
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);
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDRewardsTable::~CDRewardsTable(void) {
|
||||
for (auto e : m_entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
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) {
|
||||
if (e.second->levelID == levelID) result.push_back(e.second);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
24
dDatabase/Tables/CDRewardsTable.h
Normal file
24
dDatabase/Tables/CDRewardsTable.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
#include <string>
|
||||
|
||||
struct CDRewards {
|
||||
int32_t id;
|
||||
int32_t levelID;
|
||||
int32_t missionID;
|
||||
int32_t rewardType;
|
||||
int32_t value;
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
class CDRewardsTable : public CDTable {
|
||||
public:
|
||||
CDRewardsTable(void);
|
||||
~CDRewardsTable(void);
|
||||
|
||||
std::string GetName(void) const override;
|
||||
std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
|
||||
|
||||
private:
|
||||
std::map<uint32_t, CDRewards*> m_entries;
|
||||
};
|
47
dDatabase/Tables/CDScriptComponentTable.cpp
Normal file
47
dDatabase/Tables/CDScriptComponentTable.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
#include "CDScriptComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDScriptComponentTable::CDScriptComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ScriptComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ScriptComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDScriptComponent entry;
|
||||
entry.id = tableData.getIntField(0, -1);
|
||||
entry.script_name = tableData.getStringField(1, "");
|
||||
entry.client_script_name = tableData.getStringField(2, "");
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return m_ToReturnWhenNoneFound;
|
||||
}
|
46
dDatabase/Tables/CDScriptComponentTable.h
Normal file
46
dDatabase/Tables/CDScriptComponentTable.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
// 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 {
|
||||
private:
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
CDScriptComponent m_ToReturnWhenNoneFound;
|
||||
|
||||
public:
|
||||
//! Gets an entry by ID
|
||||
const CDScriptComponent& GetByID(unsigned int id);
|
||||
|
||||
//! Constructor
|
||||
CDScriptComponentTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDScriptComponentTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
/*!
|
||||
\param predicate The predicate
|
||||
*/
|
||||
|
||||
};
|
||||
|
84
dDatabase/Tables/CDSkillBehaviorTable.cpp
Normal file
84
dDatabase/Tables/CDSkillBehaviorTable.cpp
Normal file
@@ -0,0 +1,84 @@
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
//#include "Logger.hpp"
|
||||
|
||||
//! Constructor
|
||||
CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
|
||||
m_empty = CDSkillBehavior();
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM SkillBehavior");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM SkillBehavior");
|
||||
while (!tableData.eof()) {
|
||||
CDSkillBehavior entry;
|
||||
entry.skillID = tableData.getIntField(0, -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField(1, -1));
|
||||
entry.behaviorID = tableData.getIntField(2, -1);
|
||||
entry.imaginationcost = tableData.getIntField(3, -1);
|
||||
entry.cooldowngroup = tableData.getIntField(4, -1);
|
||||
entry.cooldown = tableData.getFloatField(5, -1.0f);
|
||||
UNUSED(entry.isNpcEditor = tableData.getIntField(6, -1) == 1 ? true : false);
|
||||
UNUSED(entry.skillIcon = tableData.getIntField(7, -1));
|
||||
UNUSED(entry.oomSkillID = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField(9, -1));
|
||||
UNUSED(entry.castTypeDesc = tableData.getIntField(10, -1));
|
||||
UNUSED(entry.imBonusUI = tableData.getIntField(11, -1));
|
||||
UNUSED(entry.lifeBonusUI = tableData.getIntField(12, -1));
|
||||
UNUSED(entry.armorBonusUI = tableData.getIntField(13, -1));
|
||||
UNUSED(entry.damageUI = tableData.getIntField(14, -1));
|
||||
UNUSED(entry.hideIcon = tableData.getIntField(15, -1) == 1 ? true : false);
|
||||
UNUSED(entry.localize = tableData.getIntField(16, -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(17, ""));
|
||||
UNUSED(entry.cancelType = tableData.getIntField(18, -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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!\n");
|
||||
std::vector<CDSkillBehavior> data; //So MSVC shuts up
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDSkillBehavior& CDSkillBehaviorTable::GetSkillByID(unsigned int skillID) {
|
||||
std::map<unsigned int, CDSkillBehavior>::iterator it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
return m_empty;
|
||||
}
|
63
dDatabase/Tables/CDSkillBehaviorTable.h
Normal file
63
dDatabase/Tables/CDSkillBehaviorTable.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#pragma once
|
||||
|
||||
// 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); //!< ??
|
||||
unsigned int behaviorID; //!< The Behavior ID of the skill
|
||||
unsigned int imaginationcost; //!< The imagination cost of the skill
|
||||
unsigned int cooldowngroup; //!< The cooldown group ID of the skill
|
||||
float cooldown; //!< The cooldown time of the skill
|
||||
UNUSED(bool isNpcEditor); //!< ???
|
||||
UNUSED(unsigned int skillIcon); //!< The Skill Icon ID
|
||||
UNUSED(std::string oomSkillID); //!< ???
|
||||
UNUSED(unsigned int oomBehaviorEffectID); //!< ???
|
||||
UNUSED(unsigned int castTypeDesc); //!< The cast type description(?)
|
||||
UNUSED(unsigned int imBonusUI); //!< The imagination bonus of the skill
|
||||
UNUSED(nsigned int lifeBonusUI); //!< The life bonus of the skill
|
||||
UNUSED(unsigned int armorBonusUI); //!< The armor bonus of the skill
|
||||
UNUSED(unsigned int damageUI); //!< ???
|
||||
UNUSED(bool hideIcon); //!< Whether or not to show the icon
|
||||
UNUSED(bool localize); //!< ???
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
UNUSED(unsigned int cancelType); //!< The cancel type (?)
|
||||
};
|
||||
|
||||
//! SkillBehavior table
|
||||
class CDSkillBehaviorTable : public CDTable {
|
||||
private:
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
|
||||
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
|
||||
*/
|
||||
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
|
||||
|
||||
//! Gets an entry by ID
|
||||
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
|
||||
};
|
||||
|
37
dDatabase/Tables/CDTable.h
Normal file
37
dDatabase/Tables/CDTable.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "../CDClientDatabase.h"
|
||||
|
||||
// C++
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
// CPPLinq
|
||||
#include "cpplinq.hpp"
|
||||
|
||||
#pragma warning (disable : 4244) //Disable double to float conversion warnings
|
||||
#pragma warning (disable : 4715) //Disable "not all control paths return a value"
|
||||
|
||||
#if defined(__unix) || defined(__APPLE__)
|
||||
//For Linux:
|
||||
typedef __int64_t __int64;
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\file CDTable.hpp
|
||||
\brief A virtual class for CDClient Tables
|
||||
*/
|
||||
|
||||
//! The base class for all CD tables
|
||||
class CDTable {
|
||||
public:
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
virtual std::string GetName() const = 0;
|
||||
};
|
58
dDatabase/Tables/CDVendorComponentTable.cpp
Normal file
58
dDatabase/Tables/CDVendorComponentTable.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
#include "CDVendorComponentTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDVendorComponentTable::CDVendorComponentTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM VendorComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
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);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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) {
|
||||
|
||||
std::vector<CDVendorComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
std::vector<CDVendorComponent> CDVendorComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
52
dDatabase/Tables/CDVendorComponentTable.h
Normal file
52
dDatabase/Tables/CDVendorComponentTable.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#pragma once
|
||||
|
||||
// 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?)
|
||||
float sellScalar; //!< Sell Scalar (what does that mean?)
|
||||
float refreshTimeSeconds; //!< The refresh time
|
||||
unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
|
||||
};
|
||||
|
||||
//! VendorComponent table
|
||||
class CDVendorComponentTable : public CDTable {
|
||||
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
|
||||
*/
|
||||
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;
|
||||
|
||||
};
|
||||
|
74
dDatabase/Tables/CDZoneTableTable.cpp
Normal file
74
dDatabase/Tables/CDZoneTableTable.cpp
Normal file
@@ -0,0 +1,74 @@
|
||||
#include "CDZoneTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDZoneTableTable::CDZoneTableTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ZoneTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ZoneTable");
|
||||
while (!tableData.eof()) {
|
||||
CDZoneTable entry;
|
||||
entry.zoneID = tableData.getIntField(0, -1);
|
||||
entry.locStatus = tableData.getIntField(1, -1);
|
||||
entry.zoneName = tableData.getStringField(2, "");
|
||||
entry.scriptID = tableData.getIntField(3, -1);
|
||||
entry.ghostdistance_min = tableData.getFloatField(4, -1.0f);
|
||||
entry.ghostdistance = tableData.getFloatField(5, -1.0f);
|
||||
entry.population_soft_cap = tableData.getIntField(6, -1);
|
||||
entry.population_hard_cap = tableData.getIntField(7, -1);
|
||||
UNUSED(entry.DisplayDescription = tableData.getStringField(8, ""));
|
||||
UNUSED(entry.mapFolder = tableData.getStringField(9, ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField(10, -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField(11, -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField(12, ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField(13, ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField(14, ""));
|
||||
entry.zoneControlTemplate = tableData.getIntField(15, -1);
|
||||
entry.widthInChunks = tableData.getIntField(16, -1);
|
||||
entry.heightInChunks = tableData.getIntField(17, -1);
|
||||
entry.petsAllowed = tableData.getIntField(18, -1) == 1 ? true : false;
|
||||
entry.localize = tableData.getIntField(19, -1) == 1 ? true : false;
|
||||
entry.fZoneWeight = tableData.getFloatField(20, -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField(21, ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField(22, -1) == 1 ? true : false;
|
||||
UNUSED(entry.disableSaveLoc = tableData.getIntField(23, -1) == 1 ? true : false);
|
||||
entry.teamRadius = tableData.getFloatField(24, -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField(25, ""));
|
||||
UNUSED(entry.mountsAllowed = tableData.getIntField(26, -1) == 1 ? true : false);
|
||||
|
||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
if (iter != m_Entries.end())
|
||||
{
|
||||
return &iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
66
dDatabase/Tables/CDZoneTableTable.h
Normal file
66
dDatabase/Tables/CDZoneTableTable.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#pragma once
|
||||
|
||||
// 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(?)
|
||||
std::string zoneName; //!< The name of the zone
|
||||
unsigned int scriptID; //!< The Script ID of the zone (ScriptsTable)
|
||||
float ghostdistance_min; //!< The minimum ghosting distance
|
||||
float ghostdistance; //!< The ghosting distance
|
||||
unsigned int population_soft_cap; //!< The "soft cap" on the world population
|
||||
unsigned int population_hard_cap; //!< The "hard cap" on the world population
|
||||
UNUSED(std::string DisplayDescription); //!< The display description of the world
|
||||
UNUSED(std::string mapFolder); //!< ???
|
||||
float smashableMinDistance; //!< The minimum smashable distance?
|
||||
float smashableMaxDistance; //!< The maximum smashable distance?
|
||||
UNUSED(std::string mixerProgram); //!< ???
|
||||
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
|
||||
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
|
||||
unsigned int zoneControlTemplate; //!< The Zone Control template
|
||||
unsigned int widthInChunks; //!< The width of the world in chunks
|
||||
unsigned int heightInChunks; //!< The height of the world in chunks
|
||||
bool petsAllowed; //!< Whether or not pets are allowed in the world
|
||||
bool localize; //!< Whether or not the world should be localized
|
||||
float fZoneWeight; //!< ???
|
||||
UNUSED(std::string thumbnail); //!< The thumbnail of the world
|
||||
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
|
||||
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
|
||||
float teamRadius; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
//! ZoneTable table
|
||||
class CDZoneTableTable : public CDTable {
|
||||
private:
|
||||
std::map<unsigned int, CDZoneTable> m_Entries;
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
CDZoneTableTable(void);
|
||||
|
||||
//! Destructor
|
||||
~CDZoneTableTable(void);
|
||||
|
||||
//! Returns the table's name
|
||||
/*!
|
||||
\return The table name
|
||||
*/
|
||||
std::string GetName(void) const override;
|
||||
|
||||
//! Queries the table with a zoneID to find.
|
||||
/*!
|
||||
\param id The zoneID
|
||||
*/
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
};
|
Reference in New Issue
Block a user