mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
refactor: Database abstraction and organization of files (#1274)
* Database: Convert to proper namespace * Database: Use base class and getter * Database: Move files around * Database: Add property Management query Database: Move over user queries Tested at gm 0 that pre-approved names are pre-approved, unapproved need moderator approval deleting characters deletes the selcted one refreshing the character page shows the last character you logged in as tested all my characters show up when i login tested that you can delete all 4 characters and the correct character is selected each time tested renaming, approving names as gm0 Database: Add ugc model getter Hey it works, look I got around the mariadb issue. Database: Add queries Database: consolidate name query Database: Add friends list query Update name of approved names query Documentation Database: Add name check Database: Add BFF Query Database: Move BFF Setter Database: Move new friend query Database: Add remove friend queries Database: Add activity log Database: Add ugc & prop content removal Database: Add model update Database: Add migration queries Database: Add character and xml queries Database: Add user queries Untested, but compiling code Need to test that new character names are properly assigned in the following scenarios gm 0 and pre-approved name gm 0 and unapproved name gm 9 and pre-approved name gm 9 and unapproved name Database: constify function arguments Database: Add pet queries * Database: Move property model queries Untested. Need to test placing a new model moving existing one removing ugc model placing ugc model moving ugc model(?) changing privacy option variously change description and name approve property can properly travel to property * Property: Move stale reference deletion * Database: Move performance update query * Database: Add bug report query * Database: Add cheat detection query * Database: Add mail send query * Untested code need to test mailing from slash command, from all users of SendMail, getting bbb of a property and sending messages to bffs * Update CDComponentsRegistryTable.h Database: Rename and add further comments Datavbase: Add comments Add some comments Build: Fix PCH directories Database: Fix time thanks apple Database: Fix compiler warnings Overload destructor Define specialty for time_t Use string instead of string_view for temp empty string Update CDTable.h Property: Update queries to use mapId Database: Reorganize Reorganize into CDClient folder and GameDatabase folder for clearer meanings and file structure Folders: Rename to GameDatabase MySQL: Remove MySQL Specifier from table Database: Move Tables to Interfaces Database: Reorder functions in header Database: Simplify property queries Database: Remove unused queries Remove extra query definitions as well Database: Consolidate User getters Database: Comment logs Update MySQLDatabase.cpp Database: Use generic code Playkey: Fix bad optional access Database: Move stuff around WorldServer: Update queries Ugc reduced by many scopes use new queries very fast tested that ugc still loads Database: Add auth queries I tested that only the correct password can sign into an account. Tested that disabled playkeys do not allow the user to play the game Database: Add donation query Database: add objectId queries Database: Add master queries Database: Fix mis-named function Database: Add slash command queries Mail: Fix itemId type CharFilter: Use new query ObjectID: Remove duplicate code SlashCommand: Update query with function Database: Add mail queries Ugc: Fix issues with saving models Resolve large scope blocks as well * Database: Add debug try catch rethrow macro * General fixes * fix play key not working * Further fixes --------- Co-authored-by: Aaron Kimbre <aronwk.aaron@gmail.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
void CDActivitiesTable::LoadValuesFromDatabase() {
|
||||
// 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("ActivityID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
|
||||
entry.minTeams = tableData.getIntField("minTeams", -1);
|
||||
entry.maxTeams = tableData.getIntField("maxTeams", -1);
|
||||
entry.minTeamSize = tableData.getIntField("minTeamSize", -1);
|
||||
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
|
||||
entry.waitTime = tableData.getIntField("waitTime", -1);
|
||||
entry.startDelay = tableData.getIntField("startDelay", -1);
|
||||
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
|
||||
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
|
||||
entry.localize = tableData.getIntField("localize", -1);
|
||||
entry.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
|
||||
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
|
||||
entry.showUIRewards = tableData.getIntField("showUIRewards", -1);
|
||||
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
|
||||
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
|
||||
private:
|
||||
std::vector<CDActivities> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
|
||||
|
||||
const std::vector<CDActivities>& GetEntries() const { return this->entries; }
|
||||
};
|
@@ -0,0 +1,45 @@
|
||||
#include "CDActivityRewardsTable.h"
|
||||
|
||||
void CDActivityRewardsTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("objectTemplate", -1);
|
||||
entry.ActivityRewardIndex = tableData.getIntField("ActivityRewardIndex", -1);
|
||||
entry.activityRating = tableData.getIntField("activityRating", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
|
||||
entry.ChallengeRating = tableData.getIntField("ChallengeRating", -1);
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
|
||||
private:
|
||||
std::vector<CDActivityRewards> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
|
||||
|
||||
std::vector<CDActivityRewards> GetEntries() const;
|
||||
|
||||
};
|
112
dDatabase/CDClientDatabase/CDClientTables/CDAnimationsTable.cpp
Normal file
112
dDatabase/CDClientDatabase/CDClientTables/CDAnimationsTable.cpp
Normal file
@@ -0,0 +1,112 @@
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "Game.h"
|
||||
|
||||
|
||||
void CDAnimationsTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
|
||||
while (!tableData.eof()) {
|
||||
std::string animation_type = tableData.getStringField("animation_type", "");
|
||||
DluAssert(!animation_type.empty());
|
||||
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
|
||||
DluAssert(animationGroupID != -1);
|
||||
|
||||
CDAnimation entry;
|
||||
entry.animation_name = tableData.getStringField("animation_name", "");
|
||||
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
|
||||
UNUSED_COLUMN(entry.min_loops = tableData.getIntField("min_loops", 0);)
|
||||
UNUSED_COLUMN(entry.max_loops = tableData.getIntField("max_loops", 0);)
|
||||
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
|
||||
UNUSED_COLUMN(entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.restartable = tableData.getIntField("restartable", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.face_animation_name = tableData.getStringField("face_animation_name", "");)
|
||||
UNUSED_COLUMN(entry.priority = tableData.getFloatField("priority", 0.0f);)
|
||||
UNUSED_COLUMN(entry.blendTime = tableData.getFloatField("blendTime", 0.0f);)
|
||||
|
||||
this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
bool CDAnimationsTable::CacheData(CppSQLite3Statement& queryToCache) {
|
||||
auto tableData = queryToCache.execQuery();
|
||||
// If we received a bad lookup, cache it anyways so we do not run the query again.
|
||||
if (tableData.eof()) return false;
|
||||
|
||||
do {
|
||||
std::string animation_type = tableData.getStringField("animation_type", "");
|
||||
DluAssert(!animation_type.empty());
|
||||
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
|
||||
DluAssert(animationGroupID != -1);
|
||||
|
||||
CDAnimation entry;
|
||||
entry.animation_name = tableData.getStringField("animation_name", "");
|
||||
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
|
||||
UNUSED_COLUMN(entry.min_loops = tableData.getIntField("min_loops", 0);)
|
||||
UNUSED_COLUMN(entry.max_loops = tableData.getIntField("max_loops", 0);)
|
||||
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
|
||||
UNUSED_COLUMN(entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.restartable = tableData.getIntField("restartable", 0) == 1;)
|
||||
UNUSED_COLUMN(entry.face_animation_name = tableData.getStringField("face_animation_name", "");)
|
||||
UNUSED_COLUMN(entry.priority = tableData.getFloatField("priority", 0.0f);)
|
||||
UNUSED_COLUMN(entry.blendTime = tableData.getFloatField("blendTime", 0.0f);)
|
||||
|
||||
this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
|
||||
tableData.nextRow();
|
||||
} while (!tableData.eof());
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CDAnimationsTable::CacheAnimations(const CDAnimationKey animationKey) {
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ? and animation_type = ?");
|
||||
query.bind(1, static_cast<int32_t>(animationKey.second));
|
||||
query.bind(2, animationKey.first.c_str());
|
||||
// If we received a bad lookup, cache it anyways so we do not run the query again.
|
||||
if (!CacheData(query)) {
|
||||
this->animations[animationKey];
|
||||
}
|
||||
}
|
||||
|
||||
void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
|
||||
auto animationEntryCached = this->animations.find(CDAnimationKey("", animationGroupID));
|
||||
if (animationEntryCached != this->animations.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ?");
|
||||
query.bind(1, static_cast<int32_t>(animationGroupID));
|
||||
|
||||
// Cache the query so we don't run the query again.
|
||||
CacheData(query);
|
||||
this->animations[CDAnimationKey("", animationGroupID)];
|
||||
}
|
||||
|
||||
CDAnimationLookupResult CDAnimationsTable::GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID) {
|
||||
CDAnimationKey animationKey(animationType, animationGroupID);
|
||||
auto animationEntryCached = this->animations.find(animationKey);
|
||||
if (animationEntryCached == this->animations.end()) {
|
||||
this->CacheAnimations(animationKey);
|
||||
}
|
||||
|
||||
auto animationEntry = this->animations.find(animationKey);
|
||||
// If we have only one animation, return it regardless of the chance to play.
|
||||
if (animationEntry->second.size() == 1) {
|
||||
return CDAnimationLookupResult(animationEntry->second.front());
|
||||
}
|
||||
auto randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
|
||||
|
||||
for (auto& animationEntry : animationEntry->second) {
|
||||
randomAnimation -= animationEntry.chance_to_play;
|
||||
// This is how the client gets the random animation.
|
||||
if (animationEntry.animation_name != previousAnimationName && randomAnimation <= 0.0f) return CDAnimationLookupResult(animationEntry);
|
||||
}
|
||||
|
||||
return CDAnimationLookupResult();
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include "CDTable.h"
|
||||
#include <list>
|
||||
|
||||
struct CDAnimation {
|
||||
// unsigned int animationGroupID;
|
||||
// std::string animation_type;
|
||||
// The above two are a pair to represent a primary key in the map.
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
UNUSED_COLUMN(unsigned int min_loops;) //!< The minimum number of loops
|
||||
UNUSED_COLUMN(unsigned int max_loops;) //!< The maximum number of loops
|
||||
float animation_length; //!< The animation length
|
||||
UNUSED_COLUMN(bool hideEquip;) //!< Whether or not to hide the equip
|
||||
UNUSED_COLUMN(bool ignoreUpperBody;) //!< Whether or not to ignore the upper body
|
||||
UNUSED_COLUMN(bool restartable;) //!< Whether or not the animation is restartable
|
||||
UNUSED_COLUMN(std::string face_animation_name;) //!< The face animation name
|
||||
UNUSED_COLUMN(float priority;) //!< The priority
|
||||
UNUSED_COLUMN(float blendTime;) //!< The blend time
|
||||
};
|
||||
|
||||
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
|
||||
|
||||
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
|
||||
typedef int32_t AnimationGroupID;
|
||||
typedef std::string AnimationID;
|
||||
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
/**
|
||||
* Given an animationType and the previousAnimationName played, return the next animationType to play.
|
||||
* If there are more than 1 animationTypes that can be played, one is selected at random but also does not allow
|
||||
* the previousAnimationName to be played twice.
|
||||
*
|
||||
* @param animationType The animationID to lookup
|
||||
* @param previousAnimationName The previously played animation
|
||||
* @param animationGroupID The animationGroupID to lookup
|
||||
* @return CDAnimationLookupResult
|
||||
*/
|
||||
[[nodiscard]] CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
|
||||
|
||||
/**
|
||||
* Cache a full AnimationGroup by its ID.
|
||||
*/
|
||||
void CacheAnimationGroup(AnimationGroupID animationGroupID);
|
||||
private:
|
||||
|
||||
/**
|
||||
* Cache all animations given a premade key
|
||||
*/
|
||||
void CacheAnimations(const CDAnimationKey animationKey);
|
||||
|
||||
/**
|
||||
* Run the query responsible for caching the data.
|
||||
* @param queryToCache
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool CacheData(CppSQLite3Statement& queryToCache);
|
||||
|
||||
/**
|
||||
* Each animation is key'd by its animationName and its animationGroupID. Each
|
||||
* animation has a possible list of animations. This is because there can be animations have a percent chance to play so one is selected at random.
|
||||
*/
|
||||
std::map<CDAnimationKey, std::list<CDAnimation>> animations;
|
||||
};
|
@@ -0,0 +1,55 @@
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
uint64_t GetKey(const uint32_t behaviorID, const uint32_t parameterID) {
|
||||
uint64_t key = behaviorID;
|
||||
key <<= 31U;
|
||||
key |= parameterID;
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
void CDBehaviorParameterTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
|
||||
while (!tableData.eof()) {
|
||||
uint32_t behaviorID = tableData.getIntField("behaviorID", -1);
|
||||
auto candidateStringToAdd = std::string(tableData.getStringField("parameterID", ""));
|
||||
auto parameter = m_ParametersList.find(candidateStringToAdd);
|
||||
uint32_t parameterId;
|
||||
if (parameter != m_ParametersList.end()) {
|
||||
parameterId = parameter->second;
|
||||
} else {
|
||||
parameterId = m_ParametersList.insert(std::make_pair(candidateStringToAdd, m_ParametersList.size())).first->second;
|
||||
}
|
||||
uint64_t hash = GetKey(behaviorID, parameterId);
|
||||
float value = tableData.getFloatField("value", -1.0f);
|
||||
|
||||
m_Entries.insert(std::make_pair(hash, value));
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
|
||||
auto parameterID = this->m_ParametersList.find(name);
|
||||
if (parameterID == this->m_ParametersList.end()) return defaultValue;
|
||||
auto hash = GetKey(behaviorID, parameterID->second);
|
||||
|
||||
// Search for specific parameter
|
||||
auto it = m_Entries.find(hash);
|
||||
return it != m_Entries.end() ? it->second : defaultValue;
|
||||
}
|
||||
|
||||
std::map<std::string, float> CDBehaviorParameterTable::GetParametersByBehaviorID(uint32_t behaviorID) {
|
||||
uint64_t hashBase = behaviorID;
|
||||
std::map<std::string, float> returnInfo;
|
||||
for (auto& [parameterString, parameterId] : m_ParametersList) {
|
||||
uint64_t hash = GetKey(hashBase, parameterId);
|
||||
auto infoCandidate = m_Entries.find(hash);
|
||||
if (infoCandidate != m_Entries.end()) {
|
||||
returnInfo.insert(std::make_pair(parameterString, infoCandidate->second));
|
||||
}
|
||||
}
|
||||
return returnInfo;
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
|
||||
private:
|
||||
typedef uint64_t BehaviorParameterHash;
|
||||
typedef float BehaviorParameterValue;
|
||||
std::unordered_map<BehaviorParameterHash, BehaviorParameterValue> m_Entries;
|
||||
std::unordered_map<std::string, uint32_t> m_ParametersList;
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
||||
|
||||
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
|
||||
};
|
@@ -0,0 +1,66 @@
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
|
||||
void CDBehaviorTemplateTable::LoadValuesFromDatabase() {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM BehaviorTemplate");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
|
||||
while (!tableData.eof()) {
|
||||
CDBehaviorTemplate entry;
|
||||
entry.behaviorID = tableData.getIntField("behaviorID", -1);
|
||||
entry.templateID = tableData.getIntField("templateID", -1);
|
||||
entry.effectID = tableData.getIntField("effectID", -1);
|
||||
auto candidateToAdd = tableData.getStringField(3, "");
|
||||
auto parameter = m_EffectHandles.find(candidateToAdd);
|
||||
if (parameter != m_EffectHandles.end()) {
|
||||
entry.effectHandle = parameter;
|
||||
} else {
|
||||
entry.effectHandle = m_EffectHandles.insert(candidateToAdd).first;
|
||||
}
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDBehaviorTemplate>& CDBehaviorTemplateTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
const CDBehaviorTemplate CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) {
|
||||
auto entry = this->entriesMappedByBehaviorID.find(behaviorID);
|
||||
if (entry == this->entriesMappedByBehaviorID.end()) {
|
||||
CDBehaviorTemplate entryToReturn;
|
||||
entryToReturn.behaviorID = 0;
|
||||
entryToReturn.effectHandle = m_EffectHandles.end();
|
||||
entryToReturn.effectID = 0;
|
||||
return entryToReturn;
|
||||
} else {
|
||||
return entry->second;
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
struct CDBehaviorTemplate {
|
||||
unsigned int behaviorID; //!< The Behavior ID
|
||||
unsigned int templateID; //!< The Template ID (LOT)
|
||||
unsigned int effectID; //!< The Effect ID attached
|
||||
std::unordered_set<std::string>::iterator effectHandle; //!< The effect handle
|
||||
};
|
||||
|
||||
|
||||
class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable> {
|
||||
private:
|
||||
std::vector<CDBehaviorTemplate> entries;
|
||||
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
|
||||
std::unordered_set<std::string> m_EffectHandles;
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
|
||||
|
||||
const std::vector<CDBehaviorTemplate>& GetEntries(void) const;
|
||||
|
||||
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);
|
||||
};
|
@@ -0,0 +1,45 @@
|
||||
#include "CDBrickIDTableTable.h"
|
||||
|
||||
void CDBrickIDTableTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("NDObjectID", -1);
|
||||
entry.LEGOBrickID = tableData.getIntField("LEGOBrickID", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDBrickIDTable>& CDBrickIDTableTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,29 @@
|
||||
#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<CDBrickIDTableTable> {
|
||||
private:
|
||||
std::vector<CDBrickIDTable> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
|
||||
|
||||
const std::vector<CDBrickIDTable>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,52 @@
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
void CDComponentsRegistryTable::LoadValuesFromDatabase() {
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
|
||||
this->mappedEntries.insert_or_assign(entry.id, 0);
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
|
||||
auto exists = mappedEntries.find(id);
|
||||
if (exists != mappedEntries.end()) {
|
||||
auto iter = mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
return iter == mappedEntries.end() ? defaultValue : iter->second;
|
||||
}
|
||||
|
||||
// Now get the data. Get all components of this entity so we dont do a query for each component
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM ComponentsRegistry WHERE id = ?;");
|
||||
query.bind(1, static_cast<int32_t>(id));
|
||||
|
||||
auto tableData = query.execQuery();
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
mappedEntries.insert_or_assign(id, 0);
|
||||
|
||||
auto iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
|
||||
return iter == this->mappedEntries.end() ? defaultValue : iter->second;
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
enum class eReplicaComponentType : uint32_t;
|
||||
struct CDComponentsRegistry {
|
||||
unsigned int id; //!< The LOT is used as the ID
|
||||
eReplicaComponentType component_type; //!< See ComponentTypes enum for values
|
||||
unsigned int component_id; //!< The ID used within the component's table (0 may either mean it's non-networked, or that the ID is actually 0
|
||||
};
|
||||
|
||||
|
||||
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
|
||||
private:
|
||||
std::unordered_map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
|
||||
};
|
@@ -0,0 +1,49 @@
|
||||
#include "CDCurrencyTableTable.h"
|
||||
|
||||
//! Constructor
|
||||
void CDCurrencyTableTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("currencyIndex", -1);
|
||||
entry.npcminlevel = tableData.getIntField("npcminlevel", -1);
|
||||
entry.minvalue = tableData.getIntField("minvalue", -1);
|
||||
entry.maxvalue = tableData.getIntField("maxvalue", -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDCurrencyTable>& CDCurrencyTableTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,31 @@
|
||||
#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<CDCurrencyTableTable> {
|
||||
private:
|
||||
std::vector<CDCurrencyTable> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
|
||||
|
||||
const std::vector<CDCurrencyTable>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,56 @@
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
|
||||
void CDDestructibleComponentTable::LoadValuesFromDatabase() {
|
||||
// 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("id", -1);
|
||||
entry.faction = tableData.getIntField("faction", -1);
|
||||
entry.factionList = tableData.getStringField("factionList", "");
|
||||
entry.life = tableData.getIntField("life", -1);
|
||||
entry.imagination = tableData.getIntField("imagination", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.CurrencyIndex = tableData.getIntField("CurrencyIndex", -1);
|
||||
entry.level = tableData.getIntField("level", -1);
|
||||
entry.armor = tableData.getFloatField("armor", -1.0f);
|
||||
entry.death_behavior = tableData.getIntField("death_behavior", -1);
|
||||
entry.isnpc = tableData.getIntField("isnpc", -1) == 1 ? true : false;
|
||||
entry.attack_priority = tableData.getIntField("attack_priority", -1);
|
||||
entry.isSmashable = tableData.getIntField("isSmashable", -1) == 1 ? true : false;
|
||||
entry.difficultyLevel = tableData.getIntField("difficultyLevel", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDDestructibleComponent>& CDDestructibleComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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; //!< ???
|
||||
};
|
||||
|
||||
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
|
||||
private:
|
||||
std::vector<CDDestructibleComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
|
||||
|
||||
const std::vector<CDDestructibleComponent>& GetEntries(void) const;
|
||||
};
|
26
dDatabase/CDClientDatabase/CDClientTables/CDEmoteTable.cpp
Normal file
26
dDatabase/CDClientDatabase/CDClientTables/CDEmoteTable.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "CDEmoteTable.h"
|
||||
|
||||
void CDEmoteTableTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
||||
while (!tableData.eof()) {
|
||||
CDEmoteTable entry;
|
||||
entry.ID = tableData.getIntField("id", -1);
|
||||
entry.animationName = tableData.getStringField("animationName", "");
|
||||
entry.iconFilename = tableData.getStringField("iconFilename", "");
|
||||
entry.channel = tableData.getIntField("channel", -1);
|
||||
entry.locked = tableData.getIntField("locked", -1) != 0;
|
||||
entry.localize = tableData.getIntField("localize", -1) != 0;
|
||||
entry.locState = tableData.getIntField("locStatus", -1);
|
||||
entry.gateVersion = tableData.getStringField("gate_version", "");
|
||||
|
||||
entries.insert(std::make_pair(entry.ID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
||||
auto itr = entries.find(id);
|
||||
return itr != entries.end() ? &itr->second : nullptr;
|
||||
}
|
37
dDatabase/CDClientDatabase/CDClientTables/CDEmoteTable.h
Normal file
37
dDatabase/CDClientDatabase/CDClientTables/CDEmoteTable.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
|
||||
struct CDEmoteTable {
|
||||
CDEmoteTable() {
|
||||
ID = -1;
|
||||
animationName = "";
|
||||
iconFilename = "";
|
||||
locState = -1;
|
||||
channel = -1;
|
||||
locked = false;
|
||||
localize = false;
|
||||
gateVersion = "";
|
||||
}
|
||||
|
||||
int ID;
|
||||
std::string animationName;
|
||||
std::string iconFilename;
|
||||
int locState;
|
||||
int channel;
|
||||
bool locked;
|
||||
bool localize;
|
||||
std::string gateVersion;
|
||||
};
|
||||
|
||||
class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
|
||||
private:
|
||||
std::map<int, CDEmoteTable> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Returns an emote by ID
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
};
|
@@ -0,0 +1,58 @@
|
||||
#include "CDFeatureGatingTable.h"
|
||||
|
||||
void CDFeatureGatingTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("featureName", "");
|
||||
entry.major = tableData.getIntField("major", -1);
|
||||
entry.current = tableData.getIntField("current", -1);
|
||||
entry.minor = tableData.getIntField("minor", -1);
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDFeatureGating>& CDFeatureGatingTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDFeatureGating {
|
||||
std::string featureName;
|
||||
int32_t major;
|
||||
int32_t current;
|
||||
int32_t minor;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
|
||||
private:
|
||||
std::vector<CDFeatureGating> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
|
||||
|
||||
bool FeatureUnlocked(const std::string& feature) const;
|
||||
|
||||
const std::vector<CDFeatureGating>& GetEntries(void) const;
|
||||
};
|
@@ -0,0 +1,47 @@
|
||||
#include "CDInventoryComponentTable.h"
|
||||
|
||||
void CDInventoryComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.itemid = tableData.getIntField("itemid", -1);
|
||||
entry.count = tableData.getIntField("count", -1);
|
||||
entry.equip = tableData.getIntField("equip", -1) == 1 ? true : false;
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDInventoryComponent>& CDInventoryComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
|
||||
private:
|
||||
std::vector<CDInventoryComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
|
||||
|
||||
const std::vector<CDInventoryComponent>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,164 @@
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
CDItemComponent CDItemComponentTable::Default = {};
|
||||
|
||||
void CDItemComponentTable::LoadValuesFromDatabase() {
|
||||
// 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("id", -1);
|
||||
entry.equipLocation = tableData.getStringField("equipLocation", "");
|
||||
entry.baseValue = tableData.getIntField("baseValue", -1);
|
||||
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField("rarity", 0);
|
||||
entry.itemType = tableData.getIntField("itemType", -1);
|
||||
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
|
||||
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
|
||||
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
|
||||
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
|
||||
entry.stackSize = tableData.getIntField("stackSize", -1);
|
||||
entry.color1 = tableData.getIntField("color1", -1);
|
||||
entry.decal = tableData.getIntField("decal", -1);
|
||||
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
|
||||
entry.buildTypes = tableData.getIntField("buildTypes", -1);
|
||||
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
|
||||
entry.animationFlag = tableData.getIntField("animationFlag", 0);
|
||||
entry.equipEffects = tableData.getIntField("equipEffects", -1);
|
||||
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField("itemRating", -1);
|
||||
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
|
||||
entry.delResIndex = tableData.getIntField("delResIndex", -1);
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
UNUSED_COLUMN(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
|
||||
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
|
||||
entry.commendationCost = tableData.getIntField("commendationCost", -1);
|
||||
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
UNUSED_COLUMN(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.forgeType = tableData.getIntField("forgeType", -1);
|
||||
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
|
||||
const auto& it = this->entries.find(skillID);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM ItemComponent WHERE id = ?;");
|
||||
query.bind(1, static_cast<int32_t>(skillID));
|
||||
|
||||
auto tableData = query.execQuery();
|
||||
if (tableData.eof()) {
|
||||
entries.insert(std::make_pair(skillID, Default));
|
||||
return Default;
|
||||
}
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDItemComponent entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.equipLocation = tableData.getStringField("equipLocation", "");
|
||||
entry.baseValue = tableData.getIntField("baseValue", -1);
|
||||
entry.isKitPiece = tableData.getIntField("isKitPiece", -1) == 1 ? true : false;
|
||||
entry.rarity = tableData.getIntField("rarity", 0);
|
||||
entry.itemType = tableData.getIntField("itemType", -1);
|
||||
entry.itemInfo = tableData.getInt64Field("itemInfo", -1);
|
||||
entry.inLootTable = tableData.getIntField("inLootTable", -1) == 1 ? true : false;
|
||||
entry.inVendor = tableData.getIntField("inVendor", -1) == 1 ? true : false;
|
||||
entry.isUnique = tableData.getIntField("isUnique", -1) == 1 ? true : false;
|
||||
entry.isBOP = tableData.getIntField("isBOP", -1) == 1 ? true : false;
|
||||
entry.isBOE = tableData.getIntField("isBOE", -1) == 1 ? true : false;
|
||||
entry.reqFlagID = tableData.getIntField("reqFlagID", -1);
|
||||
entry.reqSpecialtyID = tableData.getIntField("reqSpecialtyID", -1);
|
||||
entry.reqSpecRank = tableData.getIntField("reqSpecRank", -1);
|
||||
entry.reqAchievementID = tableData.getIntField("reqAchievementID", -1);
|
||||
entry.stackSize = tableData.getIntField("stackSize", -1);
|
||||
entry.color1 = tableData.getIntField("color1", -1);
|
||||
entry.decal = tableData.getIntField("decal", -1);
|
||||
entry.offsetGroupID = tableData.getIntField("offsetGroupID", -1);
|
||||
entry.buildTypes = tableData.getIntField("buildTypes", -1);
|
||||
entry.reqPrecondition = tableData.getStringField("reqPrecondition", "");
|
||||
entry.animationFlag = tableData.getIntField("animationFlag", 0);
|
||||
entry.equipEffects = tableData.getIntField("equipEffects", -1);
|
||||
entry.readyForQA = tableData.getIntField("readyForQA", -1) == 1 ? true : false;
|
||||
entry.itemRating = tableData.getIntField("itemRating", -1);
|
||||
entry.isTwoHanded = tableData.getIntField("isTwoHanded", -1) == 1 ? true : false;
|
||||
entry.minNumRequired = tableData.getIntField("minNumRequired", -1);
|
||||
entry.delResIndex = tableData.getIntField("delResIndex", -1);
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
|
||||
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
|
||||
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
|
||||
entry.commendationCost = tableData.getIntField("commendationCost", -1);
|
||||
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.forgeType = tableData.getIntField("forgeType", -1);
|
||||
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return Default;
|
||||
}
|
||||
|
||||
std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDItemComponent& itemComponent) {
|
||||
std::map<LOT, uint32_t> currencies = {};
|
||||
|
||||
if (!itemComponent.currencyCosts.empty()) {
|
||||
auto currencySplit = GeneralUtils::SplitString(itemComponent.currencyCosts, ',');
|
||||
for (const auto& currencyAmount : currencySplit) {
|
||||
auto amountSplit = GeneralUtils::SplitString(currencyAmount, ':');
|
||||
|
||||
// Checking for 2 here, not sure what to do when there's more stuff than expected
|
||||
if (amountSplit.size() == 2) {
|
||||
currencies.insert({
|
||||
std::stoull(amountSplit[0]),
|
||||
std::stoi(amountSplit[1])
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currencies;
|
||||
}
|
||||
|
@@ -0,0 +1,64 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include "dCommonVars.h"
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDItemComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
// Gets an entry by ID
|
||||
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
|
||||
|
||||
static CDItemComponent Default;
|
||||
};
|
@@ -0,0 +1,56 @@
|
||||
#include "CDItemSetSkillsTable.h"
|
||||
|
||||
void CDItemSetSkillsTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("SkillSetID", -1);
|
||||
entry.SkillID = tableData.getIntField("SkillID", -1);
|
||||
entry.SkillCastType = tableData.getIntField("SkillCastType", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDItemSetSkills>& CDItemSetSkillsTable::GetEntries() 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;
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDItemSetSkills {
|
||||
unsigned int SkillSetID; //!< The skill set ID
|
||||
unsigned int SkillID; //!< The skill ID
|
||||
unsigned int SkillCastType; //!< The skill cast type
|
||||
};
|
||||
|
||||
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
|
||||
private:
|
||||
std::vector<CDItemSetSkills> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
|
||||
|
||||
const std::vector<CDItemSetSkills>& GetEntries() const;
|
||||
|
||||
std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID);
|
||||
};
|
@@ -0,0 +1,58 @@
|
||||
#include "CDItemSetsTable.h"
|
||||
|
||||
void CDItemSetsTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("setID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.itemIDs = tableData.getStringField("itemIDs", "");
|
||||
entry.kitType = tableData.getIntField("kitType", -1);
|
||||
entry.kitRank = tableData.getIntField("kitRank", -1);
|
||||
entry.kitImage = tableData.getIntField("kitImage", -1);
|
||||
entry.skillSetWith2 = tableData.getIntField("skillSetWith2", -1);
|
||||
entry.skillSetWith3 = tableData.getIntField("skillSetWith3", -1);
|
||||
entry.skillSetWith4 = tableData.getIntField("skillSetWith4", -1);
|
||||
entry.skillSetWith5 = tableData.getIntField("skillSetWith5", -1);
|
||||
entry.skillSetWith6 = tableData.getIntField("skillSetWith6", -1);
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
entry.kitID = tableData.getIntField("kitID", -1);
|
||||
entry.priority = tableData.getFloatField("priority", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDItemSets>& CDItemSetsTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
35
dDatabase/CDClientDatabase/CDClientTables/CDItemSetsTable.h
Normal file
35
dDatabase/CDClientDatabase/CDClientTables/CDItemSetsTable.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDItemSetsTable : public CDTable<CDItemSetsTable> {
|
||||
private:
|
||||
std::vector<CDItemSets> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
|
||||
|
||||
const std::vector<CDItemSets>& GetEntries(void) const;
|
||||
};
|
||||
|
@@ -0,0 +1,46 @@
|
||||
#include "CDLevelProgressionLookupTable.h"
|
||||
|
||||
void CDLevelProgressionLookupTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.requiredUScore = tableData.getIntField("requiredUScore", -1);
|
||||
entry.BehaviorEffect = tableData.getStringField("BehaviorEffect", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDLevelProgressionLookup>& CDLevelProgressionLookupTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDLevelProgressionLookup {
|
||||
unsigned int id; //!< The Level ID
|
||||
unsigned int requiredUScore; //!< The required LEGO Score
|
||||
std::string BehaviorEffect; //!< The behavior effect attached to this
|
||||
};
|
||||
|
||||
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
|
||||
private:
|
||||
std::vector<CDLevelProgressionLookup> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
const std::vector<CDLevelProgressionLookup>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,58 @@
|
||||
#include "CDLootMatrixTable.h"
|
||||
|
||||
CDLootMatrix CDLootMatrixTable::ReadRow(CppSQLite3Query& tableData) const {
|
||||
CDLootMatrix entry{};
|
||||
if (tableData.eof()) return entry;
|
||||
entry.LootTableIndex = tableData.getIntField("LootTableIndex", -1);
|
||||
entry.RarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
|
||||
entry.percent = tableData.getFloatField("percent", -1.0f);
|
||||
entry.minToDrop = tableData.getIntField("minToDrop", -1);
|
||||
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
|
||||
entry.flagID = tableData.getIntField("flagID", -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
return entry;
|
||||
}
|
||||
|
||||
void CDLootMatrixTable::LoadValuesFromDatabase() {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootMatrix");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootMatrix");
|
||||
while (!tableData.eof()) {
|
||||
CDLootMatrix entry;
|
||||
uint32_t lootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
|
||||
this->entries[lootMatrixIndex].push_back(ReadRow(tableData));
|
||||
tableData.nextRow();
|
||||
}
|
||||
}
|
||||
|
||||
const LootMatrixEntries& CDLootMatrixTable::GetMatrix(uint32_t matrixId) {
|
||||
auto itr = this->entries.find(matrixId);
|
||||
if (itr != this->entries.end()) {
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM LootMatrix where LootMatrixIndex = ?;");
|
||||
query.bind(1, static_cast<int32_t>(matrixId));
|
||||
|
||||
auto tableData = query.execQuery();
|
||||
while (!tableData.eof()) {
|
||||
this->entries[matrixId].push_back(ReadRow(tableData));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
return this->entries[matrixId];
|
||||
}
|
||||
|
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDLootMatrix {
|
||||
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 flagID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
typedef uint32_t LootMatrixIndex;
|
||||
typedef std::vector<CDLootMatrix> LootMatrixEntries;
|
||||
|
||||
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Gets a matrix by ID or inserts a blank one if none existed.
|
||||
const LootMatrixEntries& GetMatrix(uint32_t matrixId);
|
||||
private:
|
||||
CDLootMatrix ReadRow(CppSQLite3Query& tableData) const;
|
||||
std::unordered_map<LootMatrixIndex, LootMatrixEntries> entries;
|
||||
};
|
||||
|
@@ -0,0 +1,86 @@
|
||||
#include "CDLootTableTable.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
|
||||
// Sort the tables by their rarity so the highest rarity items are first.
|
||||
void SortTable(LootTableEntries& table) {
|
||||
auto* componentsRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
|
||||
auto* itemComponentTable = CDClientManager::Instance().GetTable<CDItemComponentTable>();
|
||||
// We modify the table in place so the outer loop keeps track of what is sorted
|
||||
// and the inner loop finds the highest rarity item and swaps it with the current position
|
||||
// of the outer loop.
|
||||
for (auto oldItrOuter = table.begin(); oldItrOuter != table.end(); oldItrOuter++) {
|
||||
auto lootToInsert = oldItrOuter;
|
||||
// Its fine if this starts at 0, even if this doesnt match lootToInsert as the actual highest will
|
||||
// either be found and overwrite these values, or the original is somehow zero and is still the highest rarity.
|
||||
uint32_t highestLootRarity = 0;
|
||||
for (auto oldItrInner = oldItrOuter; oldItrInner != table.end(); oldItrInner++) {
|
||||
uint32_t itemComponentId = componentsRegistryTable->GetByIDAndType(oldItrInner->itemid, eReplicaComponentType::ITEM);
|
||||
uint32_t rarity = itemComponentTable->GetItemComponentByID(itemComponentId).rarity;
|
||||
if (rarity > highestLootRarity) {
|
||||
highestLootRarity = rarity;
|
||||
lootToInsert = oldItrInner;
|
||||
}
|
||||
}
|
||||
std::swap(*oldItrOuter, *lootToInsert);
|
||||
}
|
||||
}
|
||||
|
||||
CDLootTable CDLootTableTable::ReadRow(CppSQLite3Query& tableData) const {
|
||||
CDLootTable entry{};
|
||||
if (tableData.eof()) return entry;
|
||||
entry.itemid = tableData.getIntField("itemid", -1);
|
||||
entry.MissionDrop = tableData.getIntField("MissionDrop", -1) == 1 ? true : false;
|
||||
entry.sortPriority = tableData.getIntField("sortPriority", -1);
|
||||
return entry;
|
||||
}
|
||||
|
||||
void CDLootTableTable::LoadValuesFromDatabase() {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM LootTable");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM LootTable");
|
||||
while (!tableData.eof()) {
|
||||
CDLootTable entry;
|
||||
uint32_t lootTableIndex = tableData.getIntField("LootTableIndex", -1);
|
||||
|
||||
this->entries[lootTableIndex].push_back(ReadRow(tableData));
|
||||
tableData.nextRow();
|
||||
}
|
||||
for (auto& [id, table] : this->entries) {
|
||||
SortTable(table);
|
||||
}
|
||||
}
|
||||
|
||||
const LootTableEntries& CDLootTableTable::GetTable(uint32_t tableId) {
|
||||
auto itr = this->entries.find(tableId);
|
||||
if (itr != this->entries.end()) {
|
||||
return itr->second;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM LootTable WHERE LootTableIndex = ?;");
|
||||
query.bind(1, static_cast<int32_t>(tableId));
|
||||
auto tableData = query.execQuery();
|
||||
|
||||
while (!tableData.eof()) {
|
||||
CDLootTable entry;
|
||||
this->entries[tableId].push_back(ReadRow(tableData));
|
||||
tableData.nextRow();
|
||||
}
|
||||
SortTable(this->entries[tableId]);
|
||||
|
||||
return this->entries[tableId];
|
||||
}
|
26
dDatabase/CDClientDatabase/CDClientTables/CDLootTableTable.h
Normal file
26
dDatabase/CDClientDatabase/CDClientTables/CDLootTableTable.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDLootTable {
|
||||
unsigned int itemid; //!< The LOT of the item
|
||||
unsigned int LootTableIndex; //!< The Loot Table Index
|
||||
bool MissionDrop; //!< Whether or not this loot table is a mission drop
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
};
|
||||
|
||||
typedef uint32_t LootTableIndex;
|
||||
typedef std::vector<CDLootTable> LootTableEntries;
|
||||
|
||||
class CDLootTableTable : public CDTable<CDLootTableTable> {
|
||||
private:
|
||||
CDLootTable ReadRow(CppSQLite3Query& tableData) const;
|
||||
std::unordered_map<LootTableIndex, LootTableEntries> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
const LootTableEntries& GetTable(uint32_t tableId);
|
||||
};
|
||||
|
@@ -0,0 +1,53 @@
|
||||
#include "CDMissionEmailTable.h"
|
||||
|
||||
void CDMissionEmailTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("ID", -1);
|
||||
entry.messageType = tableData.getIntField("messageType", -1);
|
||||
entry.notificationGroup = tableData.getIntField("notificationGroup", -1);
|
||||
entry.missionID = tableData.getIntField("missionID", -1);
|
||||
entry.attachmentLOT = tableData.getIntField("attachmentLOT", 0);
|
||||
entry.localize = (bool)tableData.getIntField("localize", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {
|
||||
|
||||
std::vector<CDMissionEmail> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissionEmail>& CDMissionEmailTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
|
||||
private:
|
||||
std::vector<CDMissionEmail> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
|
||||
|
||||
const std::vector<CDMissionEmail>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,50 @@
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
|
||||
void CDMissionNPCComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.missionID = tableData.getIntField("missionID", -1);
|
||||
entry.offersMission = tableData.getIntField("offersMission", -1) == 1 ? true : false;
|
||||
entry.acceptsMission = tableData.getIntField("acceptsMission", -1) == 1 ? true : false;
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {
|
||||
|
||||
std::vector<CDMissionNPCComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDMissionNPCComponent>& CDMissionNPCComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
|
||||
private:
|
||||
std::vector<CDMissionNPCComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
// Gets all the entries in the table
|
||||
const std::vector<CDMissionNPCComponent>& GetEntries() const;
|
||||
|
||||
};
|
||||
|
@@ -0,0 +1,68 @@
|
||||
#include "CDMissionTasksTable.h"
|
||||
|
||||
void CDMissionTasksTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.taskType = tableData.getIntField("taskType", -1);
|
||||
entry.target = tableData.getIntField("target", -1);
|
||||
entry.targetGroup = tableData.getStringField("targetGroup", "");
|
||||
entry.targetValue = tableData.getIntField("targetValue", -1);
|
||||
entry.taskParam1 = tableData.getStringField("taskParam1", "");
|
||||
UNUSED(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
|
||||
UNUSED(entry.IconID = tableData.getIntField("IconID", -1));
|
||||
entry.uid = tableData.getIntField("uid", -1);
|
||||
UNUSED(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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) {
|
||||
tasks.push_back(&entry);
|
||||
}
|
||||
}
|
||||
|
||||
return tasks;
|
||||
}
|
||||
|
||||
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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); //!< ???
|
||||
};
|
||||
|
||||
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
|
||||
private:
|
||||
std::vector<CDMissionTasks> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
|
||||
|
||||
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
|
||||
|
||||
const std::vector<CDMissionTasks>& GetEntries() const;
|
||||
};
|
||||
|
123
dDatabase/CDClientDatabase/CDClientTables/CDMissionsTable.cpp
Normal file
123
dDatabase/CDClientDatabase/CDClientTables/CDMissionsTable.cpp
Normal file
@@ -0,0 +1,123 @@
|
||||
#include "CDMissionsTable.h"
|
||||
|
||||
CDMissions CDMissionsTable::Default = {};
|
||||
|
||||
void CDMissionsTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.defined_type = tableData.getStringField("defined_type", "");
|
||||
entry.defined_subtype = tableData.getStringField("defined_subtype", "");
|
||||
entry.UISortOrder = tableData.getIntField("UISortOrder", -1);
|
||||
entry.offer_objectID = tableData.getIntField("offer_objectID", -1);
|
||||
entry.target_objectID = tableData.getIntField("target_objectID", -1);
|
||||
entry.reward_currency = tableData.getInt64Field("reward_currency", -1);
|
||||
entry.LegoScore = tableData.getIntField("LegoScore", -1);
|
||||
entry.reward_reputation = tableData.getIntField("reward_reputation", -1);
|
||||
entry.isChoiceReward = tableData.getIntField("isChoiceReward", -1) == 1 ? true : false;
|
||||
entry.reward_item1 = tableData.getIntField("reward_item1", 0);
|
||||
entry.reward_item1_count = tableData.getIntField("reward_item1_count", 0);
|
||||
entry.reward_item2 = tableData.getIntField("reward_item2", 0);
|
||||
entry.reward_item2_count = tableData.getIntField("reward_item2_count", 0);
|
||||
entry.reward_item3 = tableData.getIntField("reward_item3", 0);
|
||||
entry.reward_item3_count = tableData.getIntField("reward_item3_count", 0);
|
||||
entry.reward_item4 = tableData.getIntField("reward_item4", 0);
|
||||
entry.reward_item4_count = tableData.getIntField("reward_item4_count", 0);
|
||||
entry.reward_emote = tableData.getIntField("reward_emote", -1);
|
||||
entry.reward_emote2 = tableData.getIntField("reward_emote2", -1);
|
||||
entry.reward_emote3 = tableData.getIntField("reward_emote3", -1);
|
||||
entry.reward_emote4 = tableData.getIntField("reward_emote4", -1);
|
||||
entry.reward_maximagination = tableData.getIntField("reward_maximagination", -1);
|
||||
entry.reward_maxhealth = tableData.getIntField("reward_maxhealth", -1);
|
||||
entry.reward_maxinventory = tableData.getIntField("reward_maxinventory", -1);
|
||||
entry.reward_maxmodel = tableData.getIntField("reward_maxmodel", -1);
|
||||
entry.reward_maxwidget = tableData.getIntField("reward_maxwidget", -1);
|
||||
entry.reward_maxwallet = tableData.getIntField("reward_maxwallet", -1);
|
||||
entry.repeatable = tableData.getIntField("repeatable", -1) == 1 ? true : false;
|
||||
entry.reward_currency_repeatable = tableData.getIntField("reward_currency_repeatable", -1);
|
||||
entry.reward_item1_repeatable = tableData.getIntField("reward_item1_repeatable", -1);
|
||||
entry.reward_item1_repeat_count = tableData.getIntField("reward_item1_repeat_count", -1);
|
||||
entry.reward_item2_repeatable = tableData.getIntField("reward_item2_repeatable", -1);
|
||||
entry.reward_item2_repeat_count = tableData.getIntField("reward_item2_repeat_count", -1);
|
||||
entry.reward_item3_repeatable = tableData.getIntField("reward_item3_repeatable", -1);
|
||||
entry.reward_item3_repeat_count = tableData.getIntField("reward_item3_repeat_count", -1);
|
||||
entry.reward_item4_repeatable = tableData.getIntField("reward_item4_repeatable", -1);
|
||||
entry.reward_item4_repeat_count = tableData.getIntField("reward_item4_repeat_count", -1);
|
||||
entry.time_limit = tableData.getIntField("time_limit", -1);
|
||||
entry.isMission = tableData.getIntField("isMission", -1) ? true : false;
|
||||
entry.missionIconID = tableData.getIntField("missionIconID", -1);
|
||||
entry.prereqMissionID = tableData.getStringField("prereqMissionID", "");
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.inMOTD = tableData.getIntField("inMOTD", -1) == 1 ? true : false;
|
||||
entry.cooldownTime = tableData.getInt64Field("cooldownTime", -1);
|
||||
entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false;
|
||||
entry.randomPool = tableData.getStringField("randomPool", "");
|
||||
entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
Default.id = -1;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
81
dDatabase/CDClientDatabase/CDClientTables/CDMissionsTable.h
Normal file
81
dDatabase/CDClientDatabase/CDClientTables/CDMissionsTable.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
#include <map>
|
||||
#include <cstdint>
|
||||
|
||||
struct CDMissions {
|
||||
int id; //!< The Mission ID
|
||||
std::string defined_type; //!< The type of mission
|
||||
std::string defined_subtype; //!< The subtype of the mission
|
||||
int UISortOrder; //!< The UI Sort Order for the mission
|
||||
int offer_objectID; //!< The LOT of the mission giver
|
||||
int target_objectID; //!< The LOT of the mission's target
|
||||
int64_t reward_currency; //!< The amount of currency to reward the player
|
||||
int LegoScore; //!< The amount of LEGO Score to reward the player
|
||||
int64_t reward_reputation; //!< The reputation to award the player
|
||||
bool isChoiceReward; //!< Whether or not the user has the option to choose their loot
|
||||
int reward_item1; //!< The first rewarded item
|
||||
int reward_item1_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2; //!< The second rewarded item
|
||||
int reward_item2_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3; //!< The third rewarded item
|
||||
int reward_item3_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4; //!< The fourth rewarded item
|
||||
int reward_item4_count; //!< The count of the fourth item to be rewarded
|
||||
int reward_emote; //!< The first emote to be rewarded
|
||||
int reward_emote2; //!< The second emote to be rewarded
|
||||
int reward_emote3; //!< The third emote to be rewarded
|
||||
int reward_emote4; //!< The fourth emote to be rewarded
|
||||
int reward_maximagination; //!< The amount of max imagination to reward
|
||||
int reward_maxhealth; //!< The amount of max health to reward
|
||||
int reward_maxinventory; //!< The amount of max inventory to reward
|
||||
int reward_maxmodel; //!< ???
|
||||
int reward_maxwidget; //!< ???
|
||||
int reward_maxwallet; //!< ???
|
||||
bool repeatable; //!< Whether or not this mission can be repeated (for instance, is it a daily mission)
|
||||
int64_t reward_currency_repeatable; //!< The repeatable reward
|
||||
int reward_item1_repeatable; //!< The first rewarded item
|
||||
int reward_item1_repeat_count; //!< The count of the first item to be rewarded
|
||||
int reward_item2_repeatable; //!< The second rewarded item
|
||||
int reward_item2_repeat_count; //!< The count of the second item to be rewarded
|
||||
int reward_item3_repeatable; //!< The third rewarded item
|
||||
int reward_item3_repeat_count; //!< The count of the third item to be rewarded
|
||||
int reward_item4_repeatable; //!< The fourth rewarded item
|
||||
int reward_item4_repeat_count; //!< The count of the fourth item to be rewarded
|
||||
int time_limit; //!< The time limit of the mission
|
||||
bool isMission; //!< Maybe to differentiate between missions and achievements?
|
||||
int missionIconID; //!< The mission icon ID
|
||||
std::string prereqMissionID; //!< A '|' seperated list of prerequisite missions
|
||||
bool localize; //!< Whether or not to localize the mission
|
||||
bool inMOTD; //!< In Match of the Day(?)
|
||||
int64_t cooldownTime; //!< The mission cooldown time
|
||||
bool isRandom; //!< ???
|
||||
std::string randomPool; //!< ???
|
||||
int UIPrereqID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(std::string HUDStates); //!< ???
|
||||
UNUSED(int locStatus); //!< ???
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
class CDMissionsTable : public CDTable<CDMissionsTable> {
|
||||
private:
|
||||
std::vector<CDMissions> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
// Gets all the entries in the table
|
||||
const std::vector<CDMissions>& GetEntries() const;
|
||||
|
||||
const CDMissions* GetPtrByMissionID(uint32_t missionID) const;
|
||||
|
||||
const CDMissions& GetByMissionID(uint32_t missionID, bool& found) const;
|
||||
|
||||
static CDMissions Default;
|
||||
};
|
||||
|
@@ -0,0 +1,51 @@
|
||||
#include "CDMovementAIComponentTable.h"
|
||||
|
||||
void CDMovementAIComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.MovementType = tableData.getStringField("MovementType", "");
|
||||
entry.WanderChance = tableData.getFloatField("WanderChance", -1.0f);
|
||||
entry.WanderDelayMin = tableData.getFloatField("WanderDelayMin", -1.0f);
|
||||
entry.WanderDelayMax = tableData.getFloatField("WanderDelayMax", -1.0f);
|
||||
entry.WanderSpeed = tableData.getFloatField("WanderSpeed", -1.0f);
|
||||
entry.WanderRadius = tableData.getFloatField("WanderRadius", -1.0f);
|
||||
entry.attachedPath = tableData.getStringField("attachedPath", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDMovementAIComponent>& CDMovementAIComponentTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDMovementAIComponent {
|
||||
unsigned int id;
|
||||
std::string MovementType;
|
||||
float WanderChance;
|
||||
float WanderDelayMin;
|
||||
float WanderDelayMax;
|
||||
float WanderSpeed;
|
||||
float WanderRadius;
|
||||
std::string attachedPath;
|
||||
};
|
||||
|
||||
class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable> {
|
||||
private:
|
||||
std::vector<CDMovementAIComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
|
||||
|
||||
// Gets all the entries in the table
|
||||
const std::vector<CDMovementAIComponent>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,46 @@
|
||||
#include "CDObjectSkillsTable.h"
|
||||
|
||||
void CDObjectSkillsTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("objectTemplate", -1);
|
||||
entry.skillID = tableData.getIntField("skillID", -1);
|
||||
entry.castOnType = tableData.getIntField("castOnType", -1);
|
||||
entry.AICombatWeight = tableData.getIntField("AICombatWeight", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDObjectSkills>& CDObjectSkillsTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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; //!< ???
|
||||
};
|
||||
|
||||
class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable> {
|
||||
private:
|
||||
std::vector<CDObjectSkills> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
// Gets all the entries in the table
|
||||
const std::vector<CDObjectSkills>& GetEntries() const;
|
||||
|
||||
};
|
||||
|
89
dDatabase/CDClientDatabase/CDClientTables/CDObjectsTable.cpp
Normal file
89
dDatabase/CDClientDatabase/CDClientTables/CDObjectsTable.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
#include "CDObjectsTable.h"
|
||||
|
||||
void CDObjectsTable::LoadValuesFromDatabase() {
|
||||
// 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("id", -1);
|
||||
entry.name = tableData.getStringField("name", "");
|
||||
UNUSED_COLUMN(entry.placeable = tableData.getIntField("placeable", -1);)
|
||||
entry.type = tableData.getStringField("type", "");
|
||||
UNUSED_COLUMN(entry.description = tableData.getStringField("description", "");)
|
||||
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1);)
|
||||
UNUSED_COLUMN(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1);)
|
||||
UNUSED_COLUMN(entry.displayName = tableData.getStringField("displayName", "");)
|
||||
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
|
||||
UNUSED_COLUMN(entry.nametag = tableData.getIntField("nametag", -1);)
|
||||
UNUSED_COLUMN(entry._internalNotes = tableData.getStringField("_internalNotes", "");)
|
||||
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1);)
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", "");)
|
||||
UNUSED_COLUMN(entry.HQ_valid = tableData.getIntField("HQ_valid", -1);)
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
m_default.id = 0;
|
||||
}
|
||||
|
||||
const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
const auto& it = this->entries.find(LOT);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
|
||||
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Objects WHERE id = ?;");
|
||||
query.bind(1, static_cast<int32_t>(LOT));
|
||||
|
||||
auto tableData = query.execQuery();
|
||||
if (tableData.eof()) {
|
||||
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("id", -1);
|
||||
entry.name = tableData.getStringField("name", "");
|
||||
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
|
||||
entry.type = tableData.getStringField("type", "");
|
||||
UNUSED(ntry.description = tableData.getStringField(4, ""));
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1));
|
||||
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
|
||||
UNUSED(entry.displayName = tableData.getStringField("displayName", ""));
|
||||
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
|
||||
UNUSED(entry.nametag = tableData.getIntField("nametag", -1));
|
||||
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return m_default;
|
||||
}
|
||||
|
33
dDatabase/CDClientDatabase/CDClientTables/CDObjectsTable.h
Normal file
33
dDatabase/CDClientDatabase/CDClientTables/CDObjectsTable.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDObjectsTable : public CDTable<CDObjectsTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDObjects> entries;
|
||||
CDObjects m_default;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Gets an entry by ID
|
||||
const CDObjects& GetByID(unsigned int LOT);
|
||||
};
|
||||
|
@@ -0,0 +1,48 @@
|
||||
#include "CDPackageComponentTable.h"
|
||||
|
||||
void CDPackageComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
entry.packageType = tableData.getIntField("packageType", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) {
|
||||
|
||||
std::vector<CDPackageComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDPackageComponent>& CDPackageComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPackageComponent {
|
||||
unsigned int id;
|
||||
unsigned int LootMatrixIndex;
|
||||
unsigned int packageType;
|
||||
};
|
||||
|
||||
class CDPackageComponentTable : public CDTable<CDPackageComponentTable> {
|
||||
private:
|
||||
std::vector<CDPackageComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate);
|
||||
|
||||
const std::vector<CDPackageComponent>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,35 @@
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
|
||||
void CDPhysicsComponentTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PhysicsComponent");
|
||||
while (!tableData.eof()) {
|
||||
CDPhysicsComponent entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.bStatic = tableData.getIntField("static", -1) != 0;
|
||||
entry.physicsAsset = tableData.getStringField("physics_asset", "");
|
||||
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
|
||||
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
|
||||
entry.speed = tableData.getFloatField("speed", -1);
|
||||
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
|
||||
entry.playerHeight = tableData.getFloatField("playerHeight");
|
||||
entry.playerRadius = tableData.getFloatField("playerRadius");
|
||||
entry.pcShapeType = tableData.getIntField("pcShapeType");
|
||||
entry.collisionGroup = tableData.getIntField("collisionGroup");
|
||||
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
|
||||
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
|
||||
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
|
||||
UNUSED(entry->friction = tableData.getFloatField("friction"));
|
||||
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
|
||||
|
||||
m_entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
|
||||
auto itr = m_entries.find(componentID);
|
||||
return itr != m_entries.end() ? &itr->second : nullptr;
|
||||
}
|
||||
|
@@ -0,0 +1,33 @@
|
||||
#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<CDPhysicsComponentTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
static const std::string GetTableName() { return "PhysicsComponent"; };
|
||||
CDPhysicsComponent* GetByID(unsigned int componentID);
|
||||
|
||||
private:
|
||||
std::map<unsigned int, CDPhysicsComponent> m_entries;
|
||||
};
|
@@ -0,0 +1,42 @@
|
||||
#include "CDPropertyEntranceComponentTable.h"
|
||||
|
||||
void CDPropertyEntranceComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// First, get the size of the table
|
||||
size_t size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyEntranceComponent");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyEntranceComponent;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyEntranceComponent{
|
||||
static_cast<uint32_t>(tableData.getIntField("id", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
|
||||
tableData.getStringField("propertyName", ""),
|
||||
static_cast<bool>(tableData.getIntField("isOnProperty", false)),
|
||||
tableData.getStringField("groupType", "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyEntranceComponent {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
std::string propertyName;
|
||||
bool isOnProperty;
|
||||
std::string groupType;
|
||||
};
|
||||
|
||||
class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
|
||||
// Gets all the entries in the table
|
||||
[[nodiscard]] const std::vector<CDPropertyEntranceComponent>& GetEntries() const { return entries; }
|
||||
private:
|
||||
std::vector<CDPropertyEntranceComponent> entries{};
|
||||
CDPropertyEntranceComponent defaultEntry{};
|
||||
};
|
@@ -0,0 +1,41 @@
|
||||
#include "CDPropertyTemplateTable.h"
|
||||
|
||||
void CDPropertyTemplateTable::LoadValuesFromDatabase() {
|
||||
|
||||
// First, get the size of the table
|
||||
size_t size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM PropertyTemplate;");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
this->entries.reserve(size);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM PropertyTemplate;");
|
||||
while (!tableData.eof()) {
|
||||
auto entry = CDPropertyTemplate{
|
||||
static_cast<uint32_t>(tableData.getIntField("id", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("mapID", -1)),
|
||||
static_cast<uint32_t>(tableData.getIntField("vendorMapID", -1)),
|
||||
tableData.getStringField("spawnName", "")
|
||||
};
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
|
||||
for (const auto& entry : entries) {
|
||||
if (entry.mapID == mapID)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return defaultEntry;
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDPropertyTemplate {
|
||||
uint32_t id;
|
||||
uint32_t mapID;
|
||||
uint32_t vendorMapID;
|
||||
std::string spawnName;
|
||||
};
|
||||
|
||||
class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
static const std::string GetTableName() { return "PropertyTemplate"; };
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
private:
|
||||
std::vector<CDPropertyTemplate> entries{};
|
||||
CDPropertyTemplate defaultEntry{};
|
||||
};
|
@@ -0,0 +1,47 @@
|
||||
#include "CDProximityMonitorComponentTable.h"
|
||||
|
||||
void CDProximityMonitorComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.Proximities = tableData.getStringField("Proximities", "");
|
||||
entry.LoadOnClient = tableData.getIntField("LoadOnClient", -1);
|
||||
entry.LoadOnServer = tableData.getIntField("LoadOnServer", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDProximityMonitorComponent>& CDProximityMonitorComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDProximityMonitorComponent {
|
||||
unsigned int id;
|
||||
std::string Proximities;
|
||||
bool LoadOnClient;
|
||||
bool LoadOnServer;
|
||||
};
|
||||
|
||||
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable> {
|
||||
private:
|
||||
std::vector<CDProximityMonitorComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate);
|
||||
|
||||
const std::vector<CDProximityMonitorComponent>& GetEntries() const;
|
||||
};
|
@@ -0,0 +1,67 @@
|
||||
#include "CDRailActivatorComponent.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
void CDRailActivatorComponentTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM RailActivatorComponent;");
|
||||
while (!tableData.eof()) {
|
||||
CDRailActivatorComponent entry;
|
||||
|
||||
entry.id = tableData.getIntField("id", 0);
|
||||
|
||||
entry.startAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startAnim", ""));
|
||||
entry.loopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopAnim", ""));
|
||||
entry.stopAnimation = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopAnim", ""));
|
||||
entry.startSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("startSound", ""));
|
||||
entry.loopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("loopSound", ""));
|
||||
entry.stopSound = GeneralUtils::ASCIIToUTF16(tableData.getStringField("stopSound", ""));
|
||||
|
||||
std::string loopEffectString(tableData.getStringField("effectIDs", ""));
|
||||
entry.loopEffectID = EffectPairFromString(loopEffectString);
|
||||
|
||||
entry.preconditions = tableData.getStringField("preconditions", "-1");
|
||||
|
||||
entry.playerCollision = tableData.getIntField("playerCollision", 0);
|
||||
|
||||
entry.cameraLocked = tableData.getIntField("cameraLocked", 0);
|
||||
|
||||
std::string startEffectString(tableData.getStringField("StartEffectID", ""));
|
||||
entry.startEffectID = EffectPairFromString(startEffectString);
|
||||
|
||||
std::string stopEffectString(tableData.getStringField("StopEffectID", ""));
|
||||
entry.stopEffectID = EffectPairFromString(stopEffectString);
|
||||
|
||||
entry.damageImmune = tableData.getIntField("DamageImmune", 0);
|
||||
|
||||
entry.noAggro = tableData.getIntField("NoAggro", 0);
|
||||
|
||||
entry.showNameBillboard = tableData.getIntField("ShowNameBillboard", 0);
|
||||
|
||||
m_Entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
|
||||
for (const auto& entry : m_Entries) {
|
||||
if (entry.id == id)
|
||||
return entry;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
const 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 {};
|
||||
}
|
||||
|
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDRailActivatorComponent {
|
||||
int32_t id;
|
||||
std::u16string startAnimation;
|
||||
std::u16string loopAnimation;
|
||||
std::u16string stopAnimation;
|
||||
std::u16string startSound;
|
||||
std::u16string loopSound;
|
||||
std::u16string stopSound;
|
||||
std::pair<uint32_t, std::u16string> startEffectID;
|
||||
std::pair<uint32_t, std::u16string> loopEffectID;
|
||||
std::pair<uint32_t, std::u16string> stopEffectID;
|
||||
std::string preconditions;
|
||||
bool playerCollision;
|
||||
bool cameraLocked;
|
||||
bool damageImmune;
|
||||
bool noAggro;
|
||||
bool showNameBillboard;
|
||||
};
|
||||
|
||||
class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
static const std::string GetTableName() { return "RailActivatorComponent"; };
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] const std::vector<CDRailActivatorComponent>& GetEntries() const;
|
||||
private:
|
||||
static std::pair<uint32_t, std::u16string> EffectPairFromString(std::string& str);
|
||||
std::vector<CDRailActivatorComponent> m_Entries{};
|
||||
};
|
@@ -0,0 +1,34 @@
|
||||
#include "CDRarityTableTable.h"
|
||||
|
||||
void CDRarityTableTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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 order by randmax desc;");
|
||||
while (!tableData.eof()) {
|
||||
uint32_t rarityTableIndex = tableData.getIntField("RarityTableIndex", -1);
|
||||
|
||||
CDRarityTable entry;
|
||||
entry.randmax = tableData.getFloatField("randmax", -1);
|
||||
entry.rarity = tableData.getIntField("rarity", -1);
|
||||
entries[rarityTableIndex].push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<CDRarityTable>& CDRarityTableTable::GetRarityTable(uint32_t id) {
|
||||
return entries[id];
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDRarityTable {
|
||||
float randmax;
|
||||
unsigned int rarity;
|
||||
};
|
||||
|
||||
typedef std::vector<CDRarityTable> RarityTable;
|
||||
|
||||
class CDRarityTableTable : public CDTable<CDRarityTableTable> {
|
||||
private:
|
||||
typedef uint32_t RarityTableIndex;
|
||||
std::unordered_map<RarityTableIndex, std::vector<CDRarityTable>> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
const std::vector<CDRarityTable>& GetRarityTable(uint32_t predicate);
|
||||
};
|
||||
|
@@ -0,0 +1,53 @@
|
||||
#include "CDRebuildComponentTable.h"
|
||||
|
||||
void CDRebuildComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.reset_time = tableData.getFloatField("reset_time", -1.0f);
|
||||
entry.complete_time = tableData.getFloatField("complete_time", -1.0f);
|
||||
entry.take_imagination = tableData.getIntField("take_imagination", -1);
|
||||
entry.interruptible = tableData.getIntField("interruptible", -1) == 1 ? true : false;
|
||||
entry.self_activator = tableData.getIntField("self_activator", -1) == 1 ? true : false;
|
||||
entry.custom_modules = tableData.getStringField("custom_modules", "");
|
||||
entry.activityID = tableData.getIntField("activityID", -1);
|
||||
entry.post_imagination_cost = tableData.getIntField("post_imagination_cost", -1);
|
||||
entry.time_before_smash = tableData.getFloatField("time_before_smash", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
const std::vector<CDRebuildComponent>& CDRebuildComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable> {
|
||||
private:
|
||||
std::vector<CDRebuildComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
|
||||
|
||||
const std::vector<CDRebuildComponent>& GetEntries() const;
|
||||
};
|
||||
|
29
dDatabase/CDClientDatabase/CDClientTables/CDRewardsTable.cpp
Normal file
29
dDatabase/CDClientDatabase/CDClientTables/CDRewardsTable.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "CDRewardsTable.h"
|
||||
|
||||
void CDRewardsTable::LoadValuesFromDatabase() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Rewards");
|
||||
while (!tableData.eof()) {
|
||||
CDRewards entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.levelID = tableData.getIntField("LevelID", -1);
|
||||
entry.missionID = tableData.getIntField("MissionID", -1);
|
||||
entry.rewardType = tableData.getIntField("RewardType", -1);
|
||||
entry.value = tableData.getIntField("value", -1);
|
||||
entry.count = tableData.getIntField("count", -1);
|
||||
|
||||
m_entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
std::vector<CDRewards> CDRewardsTable::GetByLevelID(uint32_t levelID) {
|
||||
std::vector<CDRewards> result{};
|
||||
for (const auto& e : m_entries) {
|
||||
if (e.second.levelID == levelID) result.push_back(e.second);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
23
dDatabase/CDClientDatabase/CDClientTables/CDRewardsTable.h
Normal file
23
dDatabase/CDClientDatabase/CDClientTables/CDRewardsTable.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
#include "CDTable.h"
|
||||
#include <string>
|
||||
|
||||
struct CDRewards {
|
||||
int32_t id;
|
||||
int32_t levelID;
|
||||
int32_t missionID;
|
||||
int32_t rewardType;
|
||||
int32_t value;
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
class CDRewardsTable : public CDTable<CDRewardsTable> {
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
static const std::string GetTableName() { return "Rewards"; };
|
||||
std::vector<CDRewards> GetByLevelID(uint32_t levelID);
|
||||
|
||||
private:
|
||||
std::map<uint32_t, CDRewards> m_entries;
|
||||
};
|
@@ -0,0 +1,39 @@
|
||||
#include "CDScriptComponentTable.h"
|
||||
|
||||
void CDScriptComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.script_name = tableData.getStringField("script_name", "");
|
||||
entry.client_script_name = tableData.getStringField("client_script_name", "");
|
||||
|
||||
this->entries.insert(std::make_pair(entry.id, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDScriptComponent {
|
||||
unsigned int id; //!< The component ID
|
||||
std::string script_name; //!< The script name
|
||||
std::string client_script_name; //!< The client script name
|
||||
};
|
||||
|
||||
class CDScriptComponentTable : public CDTable<CDScriptComponentTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
CDScriptComponent m_ToReturnWhenNoneFound;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Gets an entry by scriptID
|
||||
const CDScriptComponent& GetByID(unsigned int id);
|
||||
};
|
||||
|
@@ -0,0 +1,60 @@
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
|
||||
void CDSkillBehaviorTable::LoadValuesFromDatabase() {
|
||||
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("skillID", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.behaviorID = tableData.getIntField("behaviorID", -1);
|
||||
entry.imaginationcost = tableData.getIntField("imaginationcost", -1);
|
||||
entry.cooldowngroup = tableData.getIntField("cooldowngroup", -1);
|
||||
entry.cooldown = tableData.getFloatField("cooldown", -1.0f);
|
||||
UNUSED(entry.isNpcEditor = tableData.getIntField("isNpcEditor", -1) == 1 ? true : false);
|
||||
UNUSED(entry.skillIcon = tableData.getIntField("skillIcon", -1));
|
||||
UNUSED(entry.oomSkillID = tableData.getStringField("oomSkillID", ""));
|
||||
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField("oomBehaviorEffectID", -1));
|
||||
UNUSED(entry.castTypeDesc = tableData.getIntField("castTypeDesc", -1));
|
||||
UNUSED(entry.imBonusUI = tableData.getIntField("imBonusUI", -1));
|
||||
UNUSED(entry.lifeBonusUI = tableData.getIntField("lifeBonusUI", -1));
|
||||
UNUSED(entry.armorBonusUI = tableData.getIntField("armorBonusUI", -1));
|
||||
UNUSED(entry.damageUI = tableData.getIntField("damageUI", -1));
|
||||
UNUSED(entry.hideIcon = tableData.getIntField("hideIcon", -1) == 1 ? true : false);
|
||||
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.cancelType = tableData.getIntField("cancelType", -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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 (?)
|
||||
};
|
||||
|
||||
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Gets an entry by skillID
|
||||
const CDSkillBehavior& GetSkillByID(unsigned int skillID);
|
||||
};
|
||||
|
44
dDatabase/CDClientDatabase/CDClientTables/CDTable.h
Normal file
44
dDatabase/CDClientDatabase/CDClientTables/CDTable.h
Normal file
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "CDClientDatabase.h"
|
||||
#include "Singleton.h"
|
||||
#include "DluAssert.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
// CPPLinq
|
||||
#ifdef _WIN32
|
||||
#define NOMINMAX
|
||||
// windows.h has min and max macros that breaks cpplinq
|
||||
#endif
|
||||
#include "cpplinq.hpp"
|
||||
|
||||
// Used for legacy
|
||||
#define UNUSED(x)
|
||||
|
||||
// Enable this to skip some unused columns in some tables
|
||||
#define UNUSED_COLUMN(v)
|
||||
|
||||
#pragma warning (disable : 4244) //Disable double to float conversion warnings
|
||||
#pragma warning (disable : 4715) //Disable "not all control paths return a value"
|
||||
|
||||
template<class Table>
|
||||
class CDTable : public Singleton<Table> {
|
||||
protected:
|
||||
virtual ~CDTable() = default;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
class LookupResult {
|
||||
typedef std::pair<T, bool> DataType;
|
||||
public:
|
||||
LookupResult() { m_data.first = T(); m_data.second = false; };
|
||||
LookupResult(T& data) { m_data.first = data; m_data.second = true; };
|
||||
inline const T& Data() { return m_data.first; };
|
||||
inline const bool& FoundData() { return m_data.second; };
|
||||
private:
|
||||
DataType m_data;
|
||||
};
|
@@ -0,0 +1,50 @@
|
||||
#include "CDVendorComponentTable.h"
|
||||
|
||||
void CDVendorComponentTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("id", -1);
|
||||
entry.buyScalar = tableData.getFloatField("buyScalar", 0.0f);
|
||||
entry.sellScalar = tableData.getFloatField("sellScalar", -1.0f);
|
||||
entry.refreshTimeSeconds = tableData.getFloatField("refreshTimeSeconds", -1.0f);
|
||||
entry.LootMatrixIndex = tableData.getIntField("LootMatrixIndex", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Queries the table with a custom "where" clause
|
||||
std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) {
|
||||
|
||||
std::vector<CDVendorComponent> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
//! Gets all the entries in the table
|
||||
const std::vector<CDVendorComponent>& CDVendorComponentTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
};
|
||||
|
||||
class CDVendorComponentTable : public CDTable<CDVendorComponentTable> {
|
||||
private:
|
||||
std::vector<CDVendorComponent> entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
|
||||
|
||||
const std::vector<CDVendorComponent>& GetEntries(void) const;
|
||||
};
|
||||
|
@@ -0,0 +1,65 @@
|
||||
#include "CDZoneTableTable.h"
|
||||
|
||||
void CDZoneTableTable::LoadValuesFromDatabase() {
|
||||
|
||||
// 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("zoneID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.zoneName = tableData.getStringField("zoneName", "");
|
||||
entry.scriptID = tableData.getIntField("scriptID", -1);
|
||||
entry.ghostdistance_min = tableData.getFloatField("ghostdistance_min", -1.0f);
|
||||
entry.ghostdistance = tableData.getFloatField("ghostdistance", -1.0f);
|
||||
entry.population_soft_cap = tableData.getIntField("population_soft_cap", -1);
|
||||
entry.population_hard_cap = tableData.getIntField("population_hard_cap", -1);
|
||||
UNUSED(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
|
||||
UNUSED(entry.mapFolder = tableData.getStringField("mapFolder", ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||
entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", "");
|
||||
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
|
||||
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
|
||||
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
|
||||
entry.petsAllowed = tableData.getIntField("petsAllowed", -1) == 1 ? true : false;
|
||||
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
|
||||
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
|
||||
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
|
||||
entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false;
|
||||
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false;
|
||||
|
||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! 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;
|
||||
}
|
||||
|
45
dDatabase/CDClientDatabase/CDClientTables/CDZoneTableTable.h
Normal file
45
dDatabase/CDClientDatabase/CDClientTables/CDZoneTableTable.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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
|
||||
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
|
||||
bool disableSaveLoc; //!< Disables the saving location?
|
||||
float teamRadius; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
bool mountsAllowed; //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
||||
private:
|
||||
std::map<unsigned int, CDZoneTable> m_Entries;
|
||||
|
||||
public:
|
||||
void LoadValuesFromDatabase();
|
||||
|
||||
// Queries the table with a zoneID to find.
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
};
|
38
dDatabase/CDClientDatabase/CDClientTables/CMakeLists.txt
Normal file
38
dDatabase/CDClientDatabase/CDClientTables/CMakeLists.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
set(DDATABASE_CDCLIENTDATABASE_CDCLIENTTABLES_SOURCES "CDActivitiesTable.cpp"
|
||||
"CDActivityRewardsTable.cpp"
|
||||
"CDAnimationsTable.cpp"
|
||||
"CDBehaviorParameterTable.cpp"
|
||||
"CDBehaviorTemplateTable.cpp"
|
||||
"CDBrickIDTableTable.cpp"
|
||||
"CDComponentsRegistryTable.cpp"
|
||||
"CDCurrencyTableTable.cpp"
|
||||
"CDDestructibleComponentTable.cpp"
|
||||
"CDEmoteTable.cpp"
|
||||
"CDFeatureGatingTable.cpp"
|
||||
"CDInventoryComponentTable.cpp"
|
||||
"CDItemComponentTable.cpp"
|
||||
"CDItemSetSkillsTable.cpp"
|
||||
"CDItemSetsTable.cpp"
|
||||
"CDLevelProgressionLookupTable.cpp"
|
||||
"CDLootMatrixTable.cpp"
|
||||
"CDLootTableTable.cpp"
|
||||
"CDMissionEmailTable.cpp"
|
||||
"CDMissionNPCComponentTable.cpp"
|
||||
"CDMissionsTable.cpp"
|
||||
"CDMissionTasksTable.cpp"
|
||||
"CDMovementAIComponentTable.cpp"
|
||||
"CDObjectSkillsTable.cpp"
|
||||
"CDObjectsTable.cpp"
|
||||
"CDPackageComponentTable.cpp"
|
||||
"CDPhysicsComponentTable.cpp"
|
||||
"CDPropertyEntranceComponentTable.cpp"
|
||||
"CDPropertyTemplateTable.cpp"
|
||||
"CDProximityMonitorComponentTable.cpp"
|
||||
"CDRailActivatorComponent.cpp"
|
||||
"CDRarityTableTable.cpp"
|
||||
"CDRebuildComponentTable.cpp"
|
||||
"CDRewardsTable.cpp"
|
||||
"CDScriptComponentTable.cpp"
|
||||
"CDSkillBehaviorTable.cpp"
|
||||
"CDVendorComponentTable.cpp"
|
||||
"CDZoneTableTable.cpp" PARENT_SCOPE)
|
Reference in New Issue
Block a user