mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-21 21:17:25 +00:00
wow
This commit is contained in:
parent
455f9470a5
commit
79094b6664
@ -1,80 +0,0 @@
|
||||
#include "CDClientManager.h"
|
||||
#include "CDActivityRewardsTable.h"
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDCurrencyTableTable.h"
|
||||
#include "CDDestructibleComponentTable.h"
|
||||
#include "CDEmoteTable.h"
|
||||
#include "CDInventoryComponentTable.h"
|
||||
#include "CDItemComponentTable.h"
|
||||
#include "CDItemSetsTable.h"
|
||||
#include "CDItemSetSkillsTable.h"
|
||||
#include "CDLevelProgressionLookupTable.h"
|
||||
#include "CDLootMatrixTable.h"
|
||||
#include "CDLootTableTable.h"
|
||||
#include "CDMissionNPCComponentTable.h"
|
||||
#include "CDMissionTasksTable.h"
|
||||
#include "CDMissionsTable.h"
|
||||
#include "CDObjectSkillsTable.h"
|
||||
#include "CDObjectsTable.h"
|
||||
#include "CDPhysicsComponentTable.h"
|
||||
#include "CDRebuildComponentTable.h"
|
||||
#include "CDScriptComponentTable.h"
|
||||
#include "CDSkillBehaviorTable.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "CDVendorComponentTable.h"
|
||||
#include "CDActivitiesTable.h"
|
||||
#include "CDPackageComponentTable.h"
|
||||
#include "CDProximityMonitorComponentTable.h"
|
||||
#include "CDMovementAIComponentTable.h"
|
||||
#include "CDBrickIDTableTable.h"
|
||||
#include "CDRarityTableTable.h"
|
||||
#include "CDMissionEmailTable.h"
|
||||
#include "CDRewardsTable.h"
|
||||
#include "CDPropertyEntranceComponentTable.h"
|
||||
#include "CDPropertyTemplateTable.h"
|
||||
#include "CDFeatureGatingTable.h"
|
||||
#include "CDRailActivatorComponent.h"
|
||||
|
||||
CDClientManager::CDClientManager() {
|
||||
CDActivityRewardsTable::Instance();
|
||||
CDAnimationsTable::Instance();
|
||||
CDBehaviorParameterTable::Instance();
|
||||
CDBehaviorTemplateTable::Instance();
|
||||
CDComponentsRegistryTable::Instance();
|
||||
CDCurrencyTableTable::Instance();
|
||||
CDDestructibleComponentTable::Instance();
|
||||
CDEmoteTableTable::Instance();
|
||||
CDInventoryComponentTable::Instance();
|
||||
CDItemComponentTable::Instance();
|
||||
CDItemSetsTable::Instance();
|
||||
CDItemSetSkillsTable::Instance();
|
||||
CDLevelProgressionLookupTable::Instance();
|
||||
CDLootMatrixTable::Instance();
|
||||
CDLootTableTable::Instance();
|
||||
CDMissionNPCComponentTable::Instance();
|
||||
CDMissionTasksTable::Instance();
|
||||
CDMissionsTable::Instance();
|
||||
CDObjectSkillsTable::Instance();
|
||||
CDObjectsTable::Instance();
|
||||
CDPhysicsComponentTable::Instance();
|
||||
CDRebuildComponentTable::Instance();
|
||||
CDScriptComponentTable::Instance();
|
||||
CDSkillBehaviorTable::Instance();
|
||||
CDZoneTableTable::Instance();
|
||||
CDVendorComponentTable::Instance();
|
||||
CDActivitiesTable::Instance();
|
||||
CDPackageComponentTable::Instance();
|
||||
CDProximityMonitorComponentTable::Instance();
|
||||
CDMovementAIComponentTable::Instance();
|
||||
CDBrickIDTableTable::Instance();
|
||||
CDRarityTableTable::Instance();
|
||||
CDMissionEmailTable::Instance();
|
||||
CDRewardsTable::Instance();
|
||||
CDPropertyEntranceComponentTable::Instance();
|
||||
CDPropertyTemplateTable::Instance();
|
||||
CDFeatureGatingTable::Instance();
|
||||
CDRailActivatorComponentTable::Instance();
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "CDTable.h"
|
||||
|
||||
#include "Singleton.h"
|
||||
|
||||
#define UNUSED_TABLE(v)
|
||||
|
||||
/**
|
||||
* Initialize the CDClient tables so they are all loaded into memory.
|
||||
*/
|
||||
class CDClientManager : public Singleton<CDClientManager> {
|
||||
public:
|
||||
CDClientManager();
|
||||
|
||||
/**
|
||||
* Fetch a table from CDClient
|
||||
*
|
||||
* @tparam Table type to fetch
|
||||
* @return A pointer to the requested table.
|
||||
*/
|
||||
template<typename T>
|
||||
T* GetTable() {
|
||||
return &T::Instance();
|
||||
}
|
||||
};
|
@ -1,5 +1,4 @@
|
||||
set(DDATABASE_SOURCES "CDClientDatabase.cpp"
|
||||
"CDClientManager.cpp"
|
||||
"Database.cpp"
|
||||
"MigrationRunner.cpp")
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
CDActivitiesTable::CDActivitiesTable(void) {
|
||||
namespace {
|
||||
std::vector<CDActivities> entries;
|
||||
};
|
||||
|
||||
void CDActivitiesTable::LoadTableIntoMemory() {
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Activities");
|
||||
@ -14,7 +17,7 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
|
||||
@ -40,7 +43,7 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
|
||||
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
@ -49,14 +52,9 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
|
||||
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
|
||||
|
||||
std::vector<CDActivities> data = cpplinq::from(this->entries)
|
||||
std::vector<CDActivities> data = cpplinq::from(entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
@ -25,14 +25,8 @@ struct CDActivities {
|
||||
float optionalPercentage;
|
||||
};
|
||||
|
||||
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
|
||||
private:
|
||||
std::vector<CDActivities> entries;
|
||||
|
||||
public:
|
||||
CDActivitiesTable();
|
||||
namespace CDActivitiesTable {
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
|
||||
|
||||
std::vector<CDActivities> GetEntries(void) const;
|
||||
};
|
||||
|
@ -1,7 +1,10 @@
|
||||
#include "CDActivityRewardsTable.h"
|
||||
|
||||
CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
namespace {
|
||||
std::vector<CDActivityRewards> entries;
|
||||
};
|
||||
|
||||
void CDActivityRewardsTable::LoadTableIntoMemory() {
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ActivityRewards");
|
||||
@ -14,7 +17,7 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ActivityRewards");
|
||||
@ -28,7 +31,7 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
entry.ChallengeRating = tableData.getIntField("ChallengeRating", -1);
|
||||
entry.description = tableData.getStringField("description", "");
|
||||
|
||||
this->entries.push_back(entry);
|
||||
entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
@ -37,14 +40,9 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
|
||||
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
|
||||
|
||||
std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
|
||||
std::vector<CDActivityRewards> data = cpplinq::from(entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
@ -13,15 +13,8 @@ struct CDActivityRewards {
|
||||
std::string description; //!< The description
|
||||
};
|
||||
|
||||
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
|
||||
private:
|
||||
std::vector<CDActivityRewards> entries;
|
||||
|
||||
public:
|
||||
CDActivityRewardsTable();
|
||||
namespace CDActivityRewardsTable {
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
|
||||
|
||||
std::vector<CDActivityRewards> GetEntries(void) const;
|
||||
|
||||
};
|
||||
|
@ -2,52 +2,66 @@
|
||||
#include "GeneralUtils.h"
|
||||
#include "Game.h"
|
||||
|
||||
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];
|
||||
namespace {
|
||||
/**
|
||||
* Cache all animations given a premade key
|
||||
*/
|
||||
void CacheAnimations(const CDAnimationsTable::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)) {
|
||||
animations[animationKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the query responsible for caching the data.
|
||||
*/
|
||||
bool 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());
|
||||
CDAnimationsTable::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););
|
||||
|
||||
animations[CDAnimationsTable::CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
|
||||
tableData.nextRow();
|
||||
} while (!tableData.eof());
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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<CDAnimationsTable::CDAnimationKey, std::list<CDAnimation>> animations;
|
||||
};
|
||||
|
||||
void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
|
||||
auto animationEntryCached = this->animations.find(CDAnimationKey("", animationGroupID));
|
||||
if (animationEntryCached != this->animations.end()) {
|
||||
auto animationEntryCached = animations.find(CDAnimationKey("", animationGroupID));
|
||||
if (animationEntryCached != animations.end()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -56,17 +70,17 @@ void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
|
||||
|
||||
// Cache the query so we don't run the query again.
|
||||
CacheData(query);
|
||||
this->animations[CDAnimationKey("", animationGroupID)];
|
||||
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 animationEntryCached = animations.find(animationKey);
|
||||
if (animationEntryCached == animations.end()) {
|
||||
CacheAnimations(animationKey);
|
||||
}
|
||||
|
||||
auto animationEntry = this->animations.find(animationKey);
|
||||
auto animationEntry = 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());
|
||||
|
@ -22,11 +22,11 @@ struct CDAnimation {
|
||||
|
||||
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
|
||||
|
||||
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
|
||||
namespace CDAnimationsTable {
|
||||
typedef int32_t AnimationGroupID;
|
||||
typedef std::string AnimationID;
|
||||
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
|
||||
public:
|
||||
void LoadTableIntoMemory();
|
||||
/**
|
||||
* 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
|
||||
@ -43,24 +43,4 @@ public:
|
||||
* 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;
|
||||
};
|
||||
|
@ -1,7 +1,12 @@
|
||||
#include "CDBehaviorParameterTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
|
||||
namespace {
|
||||
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
|
||||
std::unordered_map<std::string, uint32_t> m_ParametersList;
|
||||
};
|
||||
|
||||
void CDBehaviorParameterTable::LoadTableIntoMemory() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
|
||||
uint32_t uniqueParameterId = 0;
|
||||
uint64_t hash = 0;
|
||||
@ -28,8 +33,8 @@ CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
|
||||
}
|
||||
|
||||
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
|
||||
auto parameterID = this->m_ParametersList.find(name);
|
||||
if (parameterID == this->m_ParametersList.end()) return defaultValue;
|
||||
auto parameterID = m_ParametersList.find(name);
|
||||
if (parameterID == m_ParametersList.end()) return defaultValue;
|
||||
|
||||
uint64_t hash = behaviorID;
|
||||
|
||||
|
@ -11,13 +11,9 @@ struct CDBehaviorParameter {
|
||||
float value; //!< The value of the behavior template
|
||||
};
|
||||
|
||||
class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
|
||||
private:
|
||||
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
|
||||
std::unordered_map<std::string, uint32_t> m_ParametersList;
|
||||
public:
|
||||
CDBehaviorParameterTable();
|
||||
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
|
||||
namespace CDBehaviorParameterTable {
|
||||
void LoadTableIntoMemory();
|
||||
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0.0f);
|
||||
|
||||
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);
|
||||
};
|
||||
|
@ -1,6 +1,12 @@
|
||||
#include "CDBehaviorTemplateTable.h"
|
||||
|
||||
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
namespace {
|
||||
std::vector<CDBehaviorTemplate> entries;
|
||||
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
|
||||
std::unordered_set<std::string> m_EffectHandles;
|
||||
};
|
||||
|
||||
void CDBehaviorTemplateTable::LoadTableIntoMemory() {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
@ -14,7 +20,7 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorTemplate");
|
||||
@ -31,8 +37,8 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
entry.effectHandle = m_EffectHandles.insert(candidateToAdd).first;
|
||||
}
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
entries.push_back(entry);
|
||||
entriesMappedByBehaviorID.insert(std::make_pair(entry.behaviorID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
@ -41,20 +47,16 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
|
||||
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
|
||||
|
||||
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
|
||||
std::vector<CDBehaviorTemplate> data = cpplinq::from(entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
const CDBehaviorTemplate CDBehaviorTemplateTable::GetByBehaviorID(uint32_t behaviorID) {
|
||||
auto entry = this->entriesMappedByBehaviorID.find(behaviorID);
|
||||
if (entry == this->entriesMappedByBehaviorID.end()) {
|
||||
auto entry = entriesMappedByBehaviorID.find(behaviorID);
|
||||
if (entry == entriesMappedByBehaviorID.end()) {
|
||||
CDBehaviorTemplate entryToReturn;
|
||||
entryToReturn.behaviorID = 0;
|
||||
entryToReturn.effectHandle = m_EffectHandles.end();
|
||||
|
@ -6,24 +6,17 @@
|
||||
#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
|
||||
uint32_t behaviorID; //!< The Behavior ID
|
||||
uint32_t templateID; //!< The Template ID (LOT)
|
||||
uint32_t 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:
|
||||
CDBehaviorTemplateTable();
|
||||
namespace CDBehaviorTemplateTable {
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
|
||||
|
||||
std::vector<CDBehaviorTemplate> GetEntries(void) const;
|
||||
|
||||
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);
|
||||
};
|
||||
|
@ -1,6 +1,10 @@
|
||||
#include "CDBrickIDTableTable.h"
|
||||
|
||||
CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
namespace {
|
||||
std::vector<CDBrickIDTable> entries;
|
||||
};
|
||||
|
||||
void CDBrickIDTableTable::LoadTableIntoMemory() {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
@ -14,7 +18,7 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BrickIDTable");
|
||||
@ -23,7 +27,7 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
entry.NDObjectID = tableData.getIntField("NDObjectID", -1);
|
||||
entry.LEGOBrickID = tableData.getIntField("LEGOBrickID", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
@ -32,14 +36,9 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
|
||||
|
||||
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
|
||||
|
||||
std::vector<CDBrickIDTable> data = cpplinq::from(this->entries)
|
||||
std::vector<CDBrickIDTable> data = cpplinq::from(entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
@ -16,14 +16,8 @@ struct CDBrickIDTable {
|
||||
|
||||
|
||||
//! BrickIDTable table
|
||||
class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable> {
|
||||
private:
|
||||
std::vector<CDBrickIDTable> entries;
|
||||
|
||||
public:
|
||||
CDBrickIDTableTable();
|
||||
namespace CDBrickIDTableTable {
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
|
||||
|
||||
std::vector<CDBrickIDTable> GetEntries(void) const;
|
||||
};
|
||||
|
@ -11,11 +11,9 @@ struct CDComponentsRegistry {
|
||||
};
|
||||
|
||||
|
||||
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
|
||||
private:
|
||||
namespace CDComponentsRegistryTable {
|
||||
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
public:
|
||||
CDComponentsRegistryTable();
|
||||
void LoadTableIntoMemory();
|
||||
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
|
||||
};
|
||||
|
@ -18,12 +18,12 @@ struct CDCurrencyTable {
|
||||
};
|
||||
|
||||
//! CurrencyTable table
|
||||
class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable> {
|
||||
namespace CDCurrencyTableTable {
|
||||
private:
|
||||
std::vector<CDCurrencyTable> entries;
|
||||
|
||||
public:
|
||||
CDCurrencyTableTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
|
||||
|
||||
|
@ -20,12 +20,12 @@ struct CDDestructibleComponent {
|
||||
int difficultyLevel; //!< ???
|
||||
};
|
||||
|
||||
class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
|
||||
namespace CDDestructibleComponentTable {
|
||||
private:
|
||||
std::vector<CDDestructibleComponent> entries;
|
||||
|
||||
public:
|
||||
CDDestructibleComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
|
||||
|
||||
|
@ -1,40 +1,30 @@
|
||||
#include "CDEmoteTable.h"
|
||||
|
||||
//! Constructor
|
||||
CDEmoteTableTable::CDEmoteTableTable(void) {
|
||||
namespace {
|
||||
std::map<int, CDEmoteTable> entries;
|
||||
};
|
||||
|
||||
void CDEmoteTableTable::LoadTableIntoMemory() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Emotes");
|
||||
while (!tableData.eof()) {
|
||||
CDEmoteTable* entry = new CDEmoteTable();
|
||||
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", "");
|
||||
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));
|
||||
entries.insert(std::make_pair(entry.ID, entry));
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
}
|
||||
|
||||
//! Destructor
|
||||
CDEmoteTableTable::~CDEmoteTableTable(void) {
|
||||
for (auto e : entries) {
|
||||
if (e.second) delete e.second;
|
||||
}
|
||||
|
||||
entries.clear();
|
||||
}
|
||||
|
||||
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
|
||||
for (auto e : entries) {
|
||||
if (e.first == id) return e.second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return entries.find(id) != entries.end() ? &entries[id] : nullptr;
|
||||
}
|
||||
|
||||
|
@ -26,13 +26,8 @@ struct CDEmoteTable {
|
||||
std::string gateVersion;
|
||||
};
|
||||
|
||||
class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
|
||||
private:
|
||||
std::map<int, CDEmoteTable*> entries;
|
||||
|
||||
public:
|
||||
CDEmoteTableTable();
|
||||
~CDEmoteTableTable();
|
||||
namespace CDEmoteTableTable {
|
||||
void LoadTableIntoMemory();
|
||||
// Returns an emote by ID
|
||||
CDEmoteTable* GetEmote(int id);
|
||||
};
|
||||
|
@ -11,12 +11,12 @@ struct CDFeatureGating {
|
||||
std::string description;
|
||||
};
|
||||
|
||||
class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
|
||||
namespace CDFeatureGatingTable {
|
||||
private:
|
||||
std::vector<CDFeatureGating> entries;
|
||||
|
||||
public:
|
||||
CDFeatureGatingTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
|
||||
|
||||
|
@ -10,12 +10,12 @@ struct CDInventoryComponent {
|
||||
bool equip; //!< Whether or not to equip the item
|
||||
};
|
||||
|
||||
class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
|
||||
namespace CDInventoryComponentTable {
|
||||
private:
|
||||
std::vector<CDInventoryComponent> entries;
|
||||
|
||||
public:
|
||||
CDInventoryComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
|
||||
|
||||
|
@ -49,12 +49,12 @@ struct CDItemComponent {
|
||||
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
|
||||
};
|
||||
|
||||
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
|
||||
namespace CDItemComponentTable {
|
||||
private:
|
||||
std::map<unsigned int, CDItemComponent> entries;
|
||||
|
||||
public:
|
||||
CDItemComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
// Gets an entry by ID
|
||||
|
@ -9,12 +9,12 @@ struct CDItemSetSkills {
|
||||
unsigned int SkillCastType; //!< The skill cast type
|
||||
};
|
||||
|
||||
class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
|
||||
namespace CDItemSetSkillsTable {
|
||||
private:
|
||||
std::vector<CDItemSetSkills> entries;
|
||||
|
||||
public:
|
||||
CDItemSetSkillsTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
|
||||
|
||||
|
@ -21,12 +21,12 @@ struct CDItemSets {
|
||||
float priority; //!< The priority
|
||||
};
|
||||
|
||||
class CDItemSetsTable : public CDTable<CDItemSetsTable> {
|
||||
namespace CDItemSetsTable {
|
||||
private:
|
||||
std::vector<CDItemSets> entries;
|
||||
|
||||
public:
|
||||
CDItemSetsTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
|
||||
|
||||
|
@ -9,12 +9,12 @@ struct CDLevelProgressionLookup {
|
||||
std::string BehaviorEffect; //!< The behavior effect attached to this
|
||||
};
|
||||
|
||||
class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
|
||||
namespace CDLevelProgressionLookupTable {
|
||||
private:
|
||||
std::vector<CDLevelProgressionLookup> entries;
|
||||
|
||||
public:
|
||||
CDLevelProgressionLookupTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
|
||||
|
||||
|
@ -15,12 +15,12 @@ struct CDLootMatrix {
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
|
||||
namespace CDLootMatrixTable {
|
||||
private:
|
||||
std::vector<CDLootMatrix> entries;
|
||||
|
||||
public:
|
||||
CDLootMatrixTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
|
||||
|
||||
|
@ -11,12 +11,12 @@ struct CDLootTable {
|
||||
unsigned int sortPriority; //!< The sorting priority
|
||||
};
|
||||
|
||||
class CDLootTableTable : public CDTable<CDLootTableTable> {
|
||||
namespace CDLootTableTable {
|
||||
private:
|
||||
std::vector<CDLootTable> entries;
|
||||
|
||||
public:
|
||||
CDLootTableTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
|
||||
|
||||
|
@ -15,12 +15,12 @@ struct CDMissionEmail {
|
||||
};
|
||||
|
||||
|
||||
class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
|
||||
namespace CDMissionEmailTable {
|
||||
private:
|
||||
std::vector<CDMissionEmail> entries;
|
||||
|
||||
public:
|
||||
CDMissionEmailTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
|
||||
|
||||
|
@ -11,12 +11,12 @@ struct CDMissionNPCComponent {
|
||||
std::string gate_version; //!< The gate version
|
||||
};
|
||||
|
||||
class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
|
||||
namespace CDMissionNPCComponentTable {
|
||||
private:
|
||||
std::vector<CDMissionNPCComponent> entries;
|
||||
|
||||
public:
|
||||
CDMissionNPCComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
|
||||
|
||||
|
@ -19,12 +19,12 @@ struct CDMissionTasks {
|
||||
UNUSED(std::string gate_version); //!< ???
|
||||
};
|
||||
|
||||
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
|
||||
namespace CDMissionTasksTable {
|
||||
private:
|
||||
std::vector<CDMissionTasks> entries;
|
||||
|
||||
public:
|
||||
CDMissionTasksTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
|
||||
|
||||
|
@ -60,12 +60,12 @@ struct CDMissions {
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
class CDMissionsTable : public CDTable<CDMissionsTable> {
|
||||
namespace CDMissionsTable {
|
||||
private:
|
||||
std::vector<CDMissions> entries;
|
||||
|
||||
public:
|
||||
CDMissionsTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
|
||||
|
||||
|
@ -14,12 +14,12 @@ struct CDMovementAIComponent {
|
||||
std::string attachedPath;
|
||||
};
|
||||
|
||||
class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable> {
|
||||
namespace CDMovementAIComponentTable {
|
||||
private:
|
||||
std::vector<CDMovementAIComponent> entries;
|
||||
|
||||
public:
|
||||
CDMovementAIComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
|
||||
|
||||
|
@ -10,12 +10,12 @@ struct CDObjectSkills {
|
||||
unsigned int AICombatWeight; //!< ???
|
||||
};
|
||||
|
||||
class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable> {
|
||||
namespace CDObjectSkillsTable {
|
||||
private:
|
||||
std::vector<CDObjectSkills> entries;
|
||||
|
||||
public:
|
||||
CDObjectSkillsTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
|
||||
|
||||
|
@ -20,13 +20,13 @@ struct CDObjects {
|
||||
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
};
|
||||
|
||||
class CDObjectsTable : public CDTable<CDObjectsTable> {
|
||||
namespace CDObjectsTable {
|
||||
private:
|
||||
std::map<unsigned int, CDObjects> entries;
|
||||
CDObjects m_default;
|
||||
|
||||
public:
|
||||
CDObjectsTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Gets an entry by ID
|
||||
const CDObjects& GetByID(unsigned int LOT);
|
||||
};
|
||||
|
@ -9,7 +9,7 @@ struct CDPackageComponent {
|
||||
unsigned int packageType;
|
||||
};
|
||||
|
||||
class CDPackageComponentTable : public CDTable<CDPackageComponentTable> {
|
||||
namespace CDPackageComponentTable {
|
||||
private:
|
||||
std::vector<CDPackageComponent> entries;
|
||||
|
||||
|
@ -21,10 +21,9 @@ struct CDPhysicsComponent {
|
||||
UNUSED(std::string gravityVolumeAsset);
|
||||
};
|
||||
|
||||
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {
|
||||
namespace CDPhysicsComponentTable {
|
||||
public:
|
||||
CDPhysicsComponentTable();
|
||||
~CDPhysicsComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
|
||||
static const std::string GetTableName() { return "PhysicsComponent"; };
|
||||
CDPhysicsComponent* GetByID(unsigned int componentID);
|
||||
|
@ -9,9 +9,9 @@ struct CDPropertyEntranceComponent {
|
||||
std::string groupType;
|
||||
};
|
||||
|
||||
class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable> {
|
||||
namespace CDPropertyEntranceComponentTable {
|
||||
public:
|
||||
CDPropertyEntranceComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
CDPropertyEntranceComponent GetByID(uint32_t id);
|
||||
|
||||
|
@ -8,9 +8,9 @@ struct CDPropertyTemplate {
|
||||
std::string spawnName;
|
||||
};
|
||||
|
||||
class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable> {
|
||||
namespace CDPropertyTemplateTable {
|
||||
public:
|
||||
CDPropertyTemplateTable();
|
||||
void LoadTableIntoMemory();
|
||||
|
||||
static const std::string GetTableName() { return "PropertyTemplate"; };
|
||||
CDPropertyTemplate GetByMapID(uint32_t mapID);
|
||||
|
@ -10,7 +10,7 @@ struct CDProximityMonitorComponent {
|
||||
bool LoadOnServer;
|
||||
};
|
||||
|
||||
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable> {
|
||||
namespace CDProximityMonitorComponentTable {
|
||||
private:
|
||||
std::vector<CDProximityMonitorComponent> entries;
|
||||
|
||||
|
@ -20,9 +20,9 @@ struct CDRailActivatorComponent {
|
||||
bool showNameBillboard;
|
||||
};
|
||||
|
||||
class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable> {
|
||||
namespace CDRailActivatorComponentTable {
|
||||
public:
|
||||
CDRailActivatorComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
static const std::string GetTableName() { return "RailActivatorComponent"; };
|
||||
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
|
||||
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
|
||||
|
@ -26,12 +26,12 @@ struct CDRarityTable {
|
||||
}
|
||||
};
|
||||
|
||||
class CDRarityTableTable : public CDTable<CDRarityTableTable> {
|
||||
namespace CDRarityTableTable {
|
||||
private:
|
||||
std::vector<CDRarityTable> entries;
|
||||
|
||||
public:
|
||||
CDRarityTableTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
|
||||
|
||||
|
@ -16,12 +16,12 @@ struct CDRebuildComponent {
|
||||
float time_before_smash; //!< The time before smash
|
||||
};
|
||||
|
||||
class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable> {
|
||||
namespace CDRebuildComponentTable {
|
||||
private:
|
||||
std::vector<CDRebuildComponent> entries;
|
||||
|
||||
public:
|
||||
CDRebuildComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
|
||||
|
||||
|
@ -11,10 +11,9 @@ struct CDRewards {
|
||||
int32_t count;
|
||||
};
|
||||
|
||||
class CDRewardsTable : public CDTable<CDRewardsTable> {
|
||||
namespace CDRewardsTable {
|
||||
public:
|
||||
CDRewardsTable();
|
||||
~CDRewardsTable();
|
||||
void LoadTableIntoMemory();
|
||||
|
||||
static const std::string GetTableName() { return "Rewards"; };
|
||||
std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
|
||||
|
@ -9,13 +9,13 @@ struct CDScriptComponent {
|
||||
std::string client_script_name; //!< The client script name
|
||||
};
|
||||
|
||||
class CDScriptComponentTable : public CDTable<CDScriptComponentTable> {
|
||||
namespace CDScriptComponentTable {
|
||||
private:
|
||||
std::map<unsigned int, CDScriptComponent> entries;
|
||||
CDScriptComponent m_ToReturnWhenNoneFound;
|
||||
|
||||
public:
|
||||
CDScriptComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Gets an entry by scriptID
|
||||
const CDScriptComponent& GetByID(unsigned int id);
|
||||
};
|
||||
|
@ -25,13 +25,13 @@ struct CDSkillBehavior {
|
||||
UNUSED(unsigned int cancelType); //!< The cancel type (?)
|
||||
};
|
||||
|
||||
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
|
||||
namespace CDSkillBehaviorTable {
|
||||
private:
|
||||
std::map<unsigned int, CDSkillBehavior> entries;
|
||||
CDSkillBehavior m_empty;
|
||||
|
||||
public:
|
||||
CDSkillBehaviorTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
|
||||
|
||||
|
@ -25,12 +25,6 @@
|
||||
#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;
|
||||
|
@ -11,12 +11,12 @@ struct CDVendorComponent {
|
||||
unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
|
||||
};
|
||||
|
||||
class CDVendorComponentTable : public CDTable<CDVendorComponentTable> {
|
||||
namespace CDVendorComponentTable {
|
||||
private:
|
||||
std::vector<CDVendorComponent> entries;
|
||||
|
||||
public:
|
||||
CDVendorComponentTable();
|
||||
void LoadTableIntoMemory();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
|
||||
|
||||
|
@ -33,12 +33,12 @@ struct CDZoneTable {
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
||||
namespace CDZoneTableTable {
|
||||
private:
|
||||
std::map<unsigned int, CDZoneTable> m_Entries;
|
||||
|
||||
public:
|
||||
CDZoneTableTable();
|
||||
void LoadTableIntoMemory();
|
||||
|
||||
// Queries the table with a zoneID to find.
|
||||
const CDZoneTable* Query(unsigned int zoneID);
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
struct BehaviorContext;
|
||||
struct BehaviorBranchContext;
|
||||
class CDBehaviorParameterTable;
|
||||
namespace CDBehaviorParameterTable; {
|
||||
|
||||
class Behavior
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user