mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
Remove inlines
Clean up macros more tomorrow Cleanup and optimize CDActivities table Remove unused include Further work on CDActivityRewards Update MasterServer.cpp Further animations work Activities still needs work for a better PK. fix type All of these replacements worked Create internal interface for animations Allows for user to just call GetAnimationTIme or PlayAnimation rather than passing in arbitrary true false statements
This commit is contained in:
@@ -16,9 +16,6 @@
|
||||
// Enable this to cache all entries in each table for fast access, comes with more memory cost
|
||||
//#define CDCLIENT_CACHE_ALL
|
||||
|
||||
// Enable this to skip some unused columns in some tables
|
||||
#define UNUSED(v)
|
||||
|
||||
/*!
|
||||
\file CDClientDatabase.hpp
|
||||
\brief An interface between the CDClient.sqlite file and the server
|
||||
|
@@ -40,7 +40,7 @@
|
||||
|
||||
CDClientManager::CDClientManager() {
|
||||
CDActivityRewardsTable::Instance();
|
||||
UNUSED(CDAnimationsTable::Instance());
|
||||
CDAnimationsTable::Instance();
|
||||
CDBehaviorParameterTable::Instance();
|
||||
CDBehaviorTemplateTable::Instance();
|
||||
CDComponentsRegistryTable::Instance();
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "Singleton.h"
|
||||
|
||||
#define UNUSED_TABLE(v)
|
||||
|
||||
/**
|
||||
* Initialize the CDClient tables so they are all loaded into memory.
|
||||
*/
|
||||
|
@@ -1,27 +1,11 @@
|
||||
#include "CDActivitiesTable.h"
|
||||
|
||||
CDActivitiesTable::CDActivitiesTable(void) {
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Activities");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
CDActivitiesTable::CDActivitiesTable() {
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
|
||||
while (!tableData.eof()) {
|
||||
CDActivities entry;
|
||||
entry.ActivityID = tableData.getIntField("ActivityID", -1);
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
ActivityID activityId = tableData.getIntField("ActivityID", -1);
|
||||
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
|
||||
entry.minTeams = tableData.getIntField("minTeams", -1);
|
||||
entry.maxTeams = tableData.getIntField("maxTeams", -1);
|
||||
@@ -29,34 +13,26 @@ CDActivitiesTable::CDActivitiesTable(void) {
|
||||
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
|
||||
entry.waitTime = tableData.getIntField("waitTime", -1);
|
||||
entry.startDelay = tableData.getIntField("startDelay", -1);
|
||||
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
|
||||
UNUSED_COLUMN(entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1));
|
||||
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
|
||||
entry.localize = tableData.getIntField("localize", -1);
|
||||
UNUSED_COLUMN(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", "");
|
||||
UNUSED_COLUMN(entry.showUIRewards = tableData.getIntField("showUIRewards", -1));
|
||||
UNUSED_COLUMN(entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1));
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
|
||||
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
|
||||
UNUSED_COLUMN(entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f));
|
||||
|
||||
auto insertedElement = this->entries.insert_or_assign(activityId, entry);
|
||||
DluAssert(insertedElement.second == true);
|
||||
|
||||
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;
|
||||
CDActivitiesResult CDActivitiesTable::GetActivity(ActivityID id) {
|
||||
const auto foundElement = this->entries.find(id);
|
||||
return foundElement != this->entries.end() ? CDActivitiesResult(foundElement->second) : CDActivitiesResult();
|
||||
}
|
||||
|
||||
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
@@ -1,38 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
typedef uint32_t ActivityID;
|
||||
|
||||
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;
|
||||
UNUSED_COLUMN(uint32_t locStatus);
|
||||
uint32_t instanceMapID;
|
||||
uint32_t minTeams;
|
||||
uint32_t maxTeams;
|
||||
uint32_t minTeamSize;
|
||||
uint32_t maxTeamSize;
|
||||
uint32_t waitTime;
|
||||
uint32_t startDelay;
|
||||
UNUSED_COLUMN(bool requiresUniqueData);
|
||||
uint32_t leaderboardType;
|
||||
UNUSED_COLUMN(bool localize);
|
||||
int32_t optionalCostLOT;
|
||||
int32_t optionalCostCount;
|
||||
UNUSED_COLUMN(bool showUIRewards);
|
||||
UNUSED_COLUMN(uint32_t CommunityActivityFlagID);
|
||||
UNUSED_COLUMN(std::string gate_version);
|
||||
bool noTeamLootOnDeath;
|
||||
float optionalPercentage;
|
||||
UNUSED_COLUMN(float optionalPercentage);
|
||||
};
|
||||
typedef LookupResult<CDActivities> CDActivitiesResult;
|
||||
|
||||
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
|
||||
private:
|
||||
std::vector<CDActivities> entries;
|
||||
std::map<ActivityID, CDActivities> entries;
|
||||
|
||||
public:
|
||||
CDActivitiesTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
|
||||
|
||||
std::vector<CDActivities> GetEntries(void) const;
|
||||
CDActivitiesResult GetActivity(ActivityID predicate);
|
||||
};
|
||||
|
@@ -4,13 +4,13 @@
|
||||
#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
|
||||
unsigned int objectTemplate;
|
||||
unsigned int ActivityRewardIndex;
|
||||
int activityRating;
|
||||
unsigned int LootMatrixIndex;
|
||||
unsigned int CurrencyIndex;
|
||||
unsigned int ChallengeRating;
|
||||
std::string description;
|
||||
};
|
||||
|
||||
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
|
||||
|
@@ -1,56 +1,84 @@
|
||||
#include "CDAnimationsTable.h"
|
||||
#include "GeneralUtils.h"
|
||||
#include "Game.h"
|
||||
|
||||
CDAnimationsTable::CDAnimationsTable(void) {
|
||||
bool CDAnimationsTable::CacheData(CppSQLite3Statement queryToCache) {
|
||||
auto tableData = queryToCache.execQuery();
|
||||
// If we received a bad lookup, cache it anyways so we do not run the query again.
|
||||
if (tableData.eof()) return false;
|
||||
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
do {
|
||||
std::string animation_type = tableData.getStringField("animation_type", "");
|
||||
DluAssert(!animation_type.empty());
|
||||
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
|
||||
DluAssert(animationGroupID != -1);
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
|
||||
while (!tableData.eof()) {
|
||||
CDAnimations entry;
|
||||
entry.animationGroupID = tableData.getIntField("animationGroupID", -1);
|
||||
entry.animation_type = tableData.getStringField("animation_type", "");
|
||||
CDAnimation entry;
|
||||
entry.animation_name = tableData.getStringField("animation_name", "");
|
||||
entry.chance_to_play = tableData.getFloatField("chance_to_play", -1.0f);
|
||||
entry.min_loops = tableData.getIntField("min_loops", -1);
|
||||
entry.max_loops = tableData.getIntField("max_loops", -1);
|
||||
entry.animation_length = tableData.getFloatField("animation_length", -1.0f);
|
||||
entry.hideEquip = tableData.getIntField("hideEquip", -1) == 1 ? true : false;
|
||||
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", -1) == 1 ? true : false;
|
||||
entry.restartable = tableData.getIntField("restartable", -1) == 1 ? true : false;
|
||||
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
|
||||
entry.min_loops = tableData.getIntField("min_loops", 0);
|
||||
entry.max_loops = tableData.getIntField("max_loops", 0);
|
||||
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
|
||||
entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;
|
||||
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;
|
||||
entry.restartable = tableData.getIntField("restartable", 0) == 1;
|
||||
entry.face_animation_name = tableData.getStringField("face_animation_name", "");
|
||||
entry.priority = tableData.getFloatField("priority", -1.0f);
|
||||
entry.blendTime = tableData.getFloatField("blendTime", -1.0f);
|
||||
entry.priority = tableData.getFloatField("priority", 0.0f);
|
||||
entry.blendTime = tableData.getFloatField("blendTime", 0.0f);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
|
||||
tableData.nextRow();
|
||||
}
|
||||
} while (!tableData.eof());
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
|
||||
|
||||
std::vector<CDAnimations> data = cpplinq::from(this->entries)
|
||||
>> cpplinq::where(predicate)
|
||||
>> cpplinq::to_vector();
|
||||
|
||||
return data;
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
|
||||
return this->entries;
|
||||
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 randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
|
||||
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());
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
@@ -3,9 +3,10 @@
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
struct CDAnimations {
|
||||
unsigned int animationGroupID; //!< The animation group ID
|
||||
std::string animation_type; //!< The animation type
|
||||
struct CDAnimation {
|
||||
// unsigned int animationGroupID;
|
||||
// std::string animation_type;
|
||||
// The above two are a pair to represent a primary key in the map.
|
||||
std::string animation_name; //!< The animation name
|
||||
float chance_to_play; //!< The chance to play the animation
|
||||
unsigned int min_loops; //!< The minimum number of loops
|
||||
@@ -19,15 +20,20 @@ struct CDAnimations {
|
||||
float blendTime; //!< The blend time
|
||||
};
|
||||
|
||||
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
|
||||
|
||||
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
|
||||
private:
|
||||
std::vector<CDAnimations> entries;
|
||||
|
||||
typedef int32_t AnimationGroupID;
|
||||
typedef std::string AnimationID;
|
||||
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
|
||||
public:
|
||||
CDAnimationsTable();
|
||||
// Queries the table with a custom "where" clause
|
||||
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
|
||||
|
||||
std::vector<CDAnimations> GetEntries(void) const;
|
||||
CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
|
||||
void CacheAnimationGroup(AnimationGroupID animationGroupID);
|
||||
private:
|
||||
void CacheAnimations(const CDAnimationKey animationKey);
|
||||
bool CacheData(CppSQLite3Statement queryToCache);
|
||||
/**
|
||||
* Each animation type has a vector 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::vector<CDAnimation>> animations;
|
||||
};
|
||||
|
@@ -1,93 +1,31 @@
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "dLogger.h"
|
||||
#include "Game.h"
|
||||
|
||||
#define CDCLIENT_CACHE_ALL
|
||||
uint64_t CalculateId(uint64_t lhs, uint64_t rhs) {
|
||||
return (lhs << 32) | rhs;
|
||||
}
|
||||
|
||||
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
|
||||
void CDComponentsRegistryTable::ReadRow(CppSQLite3Query& rowData) {
|
||||
uint32_t id = rowData.getIntField("id", -1);
|
||||
eReplicaComponentType component_type = static_cast<eReplicaComponentType>(rowData.getIntField("component_type", 0));
|
||||
uint32_t component_id = rowData.getIntField("component_id", -1);
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
// First, get the size of the table
|
||||
unsigned int size = 0;
|
||||
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
|
||||
while (!tableSize.eof()) {
|
||||
size = tableSize.getIntField(0, 0);
|
||||
auto insertedEntry = this->mappedEntries.insert_or_assign(CalculateId(id, static_cast<uint64_t>(component_type)), component_id);
|
||||
DluAssert(insertedEntry.second == true);
|
||||
}
|
||||
|
||||
tableSize.nextRow();
|
||||
}
|
||||
|
||||
tableSize.finalize();
|
||||
|
||||
// Reserve the size
|
||||
//this->entries.reserve(size);
|
||||
|
||||
// Now get the data
|
||||
CDComponentsRegistryTable::CDComponentsRegistryTable() {
|
||||
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);
|
||||
|
||||
ReadRow(tableData);
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
|
||||
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
|
||||
if (iter == this->mappedEntries.end()) {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
return iter->second;
|
||||
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
// Now get the data
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM ComponentsRegistry WHERE id = " << std::to_string(id);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
while (!tableData.eof()) {
|
||||
CDComponentsRegistry entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.component_type = tableData.getIntField("component_type", -1);
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
//this->entries.push_back(entry);
|
||||
|
||||
//Darwin's stuff:
|
||||
const auto& it = this->mappedEntries.find(entry.id);
|
||||
if (it != mappedEntries.end()) {
|
||||
const auto& iter = it->second.find(entry.component_type);
|
||||
if (iter == it->second.end()) {
|
||||
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
|
||||
}
|
||||
} else {
|
||||
std::map<unsigned int, unsigned int> map;
|
||||
map.insert(std::make_pair(entry.component_type, entry.component_id));
|
||||
this->mappedEntries.insert(std::make_pair(entry.id, map));
|
||||
}
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
tableData.finalize();
|
||||
|
||||
const auto& it2 = this->mappedEntries.find(id);
|
||||
if (it2 != mappedEntries.end()) {
|
||||
const auto& iter = it2->second.find(componentType);
|
||||
if (iter != it2->second.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
}
|
||||
|
||||
return defaultValue;
|
||||
#endif
|
||||
const auto iter = this->mappedEntries.find(CalculateId(id, static_cast<uint64_t>(componentType)));
|
||||
return iter != this->mappedEntries.end() ? iter->second : defaultValue;
|
||||
}
|
||||
|
||||
|
@@ -1,21 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
// Custom Classes
|
||||
#include "CDTable.h"
|
||||
|
||||
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::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
|
||||
|
||||
public:
|
||||
CDComponentsRegistryTable();
|
||||
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
|
||||
private:
|
||||
void ReadRow(CppSQLite3Query& rowData);
|
||||
private:
|
||||
std::unordered_map<uint64_t, uint32_t> mappedEntries;
|
||||
};
|
||||
|
@@ -3,8 +3,7 @@
|
||||
|
||||
CDItemComponent CDItemComponentTable::Default = {};
|
||||
|
||||
//! Constructor
|
||||
CDItemComponentTable::CDItemComponentTable(void) {
|
||||
CDItemComponentTable::CDItemComponentTable() {
|
||||
Default = CDItemComponent();
|
||||
|
||||
#ifdef CDCLIENT_CACHE_ALL
|
||||
@@ -55,13 +54,13 @@ CDItemComponentTable::CDItemComponentTable(void) {
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
entry.audioEventUse = tableData.getStringField("audioEventUse", "");
|
||||
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);
|
||||
entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");
|
||||
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");)
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");
|
||||
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);
|
||||
@@ -74,8 +73,8 @@ CDItemComponentTable::CDItemComponentTable(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
|
||||
const auto& it = this->entries.find(skillID);
|
||||
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int id) {
|
||||
const auto& it = this->entries.find(id);
|
||||
if (it != this->entries.end()) {
|
||||
return it->second;
|
||||
}
|
||||
@@ -83,11 +82,11 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
|
||||
#ifndef CDCLIENT_CACHE_ALL
|
||||
std::stringstream query;
|
||||
|
||||
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(skillID);
|
||||
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(id);
|
||||
|
||||
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
|
||||
if (tableData.eof()) {
|
||||
entries.insert(std::make_pair(skillID, Default));
|
||||
entries.insert(std::make_pair(id, Default));
|
||||
return Default;
|
||||
}
|
||||
|
||||
@@ -125,13 +124,13 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
|
||||
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
|
||||
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
|
||||
entry.subItems = tableData.getStringField("subItems", "");
|
||||
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
|
||||
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(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
|
||||
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
|
||||
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
|
||||
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
|
||||
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);
|
||||
@@ -140,7 +139,7 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
const auto& it2 = this->entries.find(skillID);
|
||||
const auto& it2 = this->entries.find(id);
|
||||
if (it2 != this->entries.end()) {
|
||||
return it2->second;
|
||||
}
|
||||
@@ -169,4 +168,3 @@ std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDIt
|
||||
|
||||
return currencies;
|
||||
}
|
||||
|
||||
|
@@ -5,60 +5,60 @@
|
||||
#include "dCommonVars.h"
|
||||
|
||||
struct CDItemComponent {
|
||||
unsigned int id; //!< The Component ID
|
||||
uint32_t id; //!< The Component ID
|
||||
std::string equipLocation; //!< The equip location
|
||||
unsigned int baseValue; //!< The monetary base value of the item
|
||||
uint32_t 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
|
||||
uint32_t rarity; //!< The rarity of the item
|
||||
uint32_t 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
|
||||
uint32_t reqFlagID; //!< User must have completed this flag to get the item
|
||||
uint32_t reqSpecialtyID; //!< ???
|
||||
uint32_t reqSpecRank; //!< ???
|
||||
uint32_t reqAchievementID; //!< The required achievement must be completed
|
||||
uint32_t stackSize; //!< The stack size of the item
|
||||
uint32_t color1; //!< Something to do with item color...
|
||||
uint32_t decal; //!< The decal of the item
|
||||
uint32_t offsetGroupID; //!< Something to do with group IDs
|
||||
uint32_t 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
|
||||
uint32_t animationFlag; //!< The Animation Flag
|
||||
uint32_t equipEffects; //!< The effect played when the item is equipped
|
||||
bool readyForQA; //!< ???
|
||||
unsigned int itemRating; //!< ???
|
||||
uint32_t 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; //!< ???
|
||||
uint32_t minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
|
||||
uint32_t delResIndex; //!< ???
|
||||
uint32_t currencyLOT; //!< ???
|
||||
uint32_t 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); //!< ???
|
||||
UNUSED_COLUMN(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); //!< ???
|
||||
uint32_t commendationLOT; //!< The commendation LOT
|
||||
uint32_t commendationCost; //!< The commendation cost
|
||||
UNUSED_COLUMN(std::string audioEquipMetaEventSet); //!< ???
|
||||
std::string currencyCosts; //!< Used for crafting
|
||||
UNUSED(std::string ingredientInfo); //!< Unused
|
||||
unsigned int locStatus; //!< ???
|
||||
unsigned int forgeType; //!< Forge Type
|
||||
UNUSED_COLUMN(std::string ingredientInfo); //!< Unused
|
||||
uint32_t locStatus; //!< ???
|
||||
uint32_t 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;
|
||||
std::map<uint32_t, CDItemComponent> entries;
|
||||
|
||||
public:
|
||||
CDItemComponentTable();
|
||||
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
|
||||
|
||||
// Gets an entry by ID
|
||||
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
|
||||
const CDItemComponent& GetItemComponentByID(uint32_t id);
|
||||
|
||||
static CDItemComponent Default;
|
||||
};
|
||||
|
@@ -29,7 +29,7 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
|
||||
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.flagID = tableData.getIntField("flagID", -1);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
|
@@ -12,7 +12,7 @@ struct CDLootMatrix {
|
||||
unsigned int maxToDrop; //!< The maximum amount of loot from this matrix to drop
|
||||
unsigned int id; //!< The ID of the Loot Matrix
|
||||
unsigned int flagID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The Gate Version
|
||||
UNUSED_COLUMN(std::string gate_version); //!< The Gate Version
|
||||
};
|
||||
|
||||
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
|
||||
|
@@ -22,18 +22,18 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
|
||||
while (!tableData.eof()) {
|
||||
CDMissionTasks entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
UNUSED_COLUMN(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));
|
||||
UNUSED_COLUMN(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
|
||||
UNUSED_COLUMN(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", ""));
|
||||
UNUSED_COLUMN(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
|
||||
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
|
||||
this->entries.push_back(entry);
|
||||
tableData.nextRow();
|
||||
|
@@ -5,18 +5,18 @@
|
||||
|
||||
struct CDMissionTasks {
|
||||
unsigned int id; //!< The Mission ID that the task belongs to
|
||||
UNUSED(unsigned int locStatus); //!< ???
|
||||
UNUSED_COLUMN(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); //!< ???
|
||||
UNUSED_COLUMN(std::string largeTaskIcon); //!< ???
|
||||
UNUSED_COLUMN(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); //!< ???
|
||||
UNUSED_COLUMN(unsigned int largeTaskIconID); //!< ???
|
||||
UNUSED_COLUMN(bool localize); //!< Whether or not the task should be localized
|
||||
UNUSED_COLUMN(std::string gate_version); //!< ???
|
||||
};
|
||||
|
||||
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
|
||||
|
@@ -71,9 +71,9 @@ CDMissionsTable::CDMissionsTable(void) {
|
||||
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));
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED_COLUMN(entry.HUDStates = tableData.getStringField("HUDStates", ""));
|
||||
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
|
||||
|
||||
this->entries.push_back(entry);
|
||||
|
@@ -54,9 +54,9 @@ struct CDMissions {
|
||||
bool isRandom; //!< ???
|
||||
std::string randomPool; //!< ???
|
||||
int UIPrereqID; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(std::string HUDStates); //!< ???
|
||||
UNUSED(int locStatus); //!< ???
|
||||
UNUSED_COLUMN(std::string gate_version); //!< The gate version
|
||||
UNUSED_COLUMN(std::string HUDStates); //!< ???
|
||||
UNUSED_COLUMN(int locStatus); //!< ???
|
||||
int reward_bankinventory; //!< The amount of bank space this mission rewards
|
||||
};
|
||||
|
||||
|
@@ -65,18 +65,18 @@ const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
|
||||
CDObjects entry;
|
||||
entry.id = tableData.getIntField("id", -1);
|
||||
entry.name = tableData.getStringField("name", "");
|
||||
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
|
||||
UNUSED_COLUMN(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", ""));
|
||||
UNUSED_COLUMN(ntry.description = tableData.getStringField(4, ""));
|
||||
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(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));
|
||||
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();
|
||||
|
@@ -6,18 +6,18 @@
|
||||
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
|
||||
UNUSED_COLUMN(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
|
||||
UNUSED_COLUMN(std::string description); //!< An internal description of the object
|
||||
UNUSED_COLUMN(unsigned int localize); //!< Whether or not the object should localize
|
||||
UNUSED_COLUMN(unsigned int npcTemplateID); //!< Something related to NPCs...
|
||||
UNUSED_COLUMN(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
|
||||
UNUSED_COLUMN(unsigned int nametag); //!< ???
|
||||
UNUSED_COLUMN(std::string _internalNotes); //!< Some internal notes (rarely used)
|
||||
UNUSED_COLUMN(unsigned int locStatus); //!< ???
|
||||
UNUSED_COLUMN(std::string gate_version); //!< The gate version for the object
|
||||
UNUSED_COLUMN(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
|
||||
};
|
||||
|
||||
class CDObjectsTable : public CDTable<CDObjectsTable> {
|
||||
|
@@ -7,19 +7,19 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
|
||||
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);
|
||||
UNUSED_COLUMN(entry->jump = tableData.getIntField("jump", -1) != 0);
|
||||
UNUSED_COLUMN(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
|
||||
entry->speed = tableData.getFloatField("speed", -1);
|
||||
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
|
||||
UNUSED_COLUMN(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"));
|
||||
UNUSED_COLUMN(entry->airSpeed = tableData.getFloatField("airSpeed"));
|
||||
UNUSED_COLUMN(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
|
||||
UNUSED_COLUMN(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
|
||||
UNUSED_COLUMN(entry->friction = tableData.getFloatField("friction"));
|
||||
UNUSED_COLUMN(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
|
||||
|
||||
m_entries.insert(std::make_pair(entry->id, entry));
|
||||
tableData.nextRow();
|
||||
|
@@ -6,19 +6,19 @@ struct CDPhysicsComponent {
|
||||
int id;
|
||||
bool bStatic;
|
||||
std::string physicsAsset;
|
||||
UNUSED(bool jump);
|
||||
UNUSED(bool doublejump);
|
||||
UNUSED_COLUMN(bool jump);
|
||||
UNUSED_COLUMN(bool doublejump);
|
||||
float speed;
|
||||
UNUSED(float rotSpeed);
|
||||
UNUSED_COLUMN(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);
|
||||
UNUSED_COLUMN(float airSpeed);
|
||||
UNUSED_COLUMN(std::string boundaryAsset);
|
||||
UNUSED_COLUMN(float jumpAirSpeed);
|
||||
UNUSED_COLUMN(float friction);
|
||||
UNUSED_COLUMN(std::string gravityVolumeAsset);
|
||||
};
|
||||
|
||||
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {
|
||||
|
@@ -24,24 +24,24 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
|
||||
while (!tableData.eof()) {
|
||||
CDSkillBehavior entry;
|
||||
entry.skillID = tableData.getIntField("skillID", -1);
|
||||
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
|
||||
UNUSED_COLUMN(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));
|
||||
UNUSED_COLUMN(entry.isNpcEditor = tableData.getIntField("isNpcEditor", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.skillIcon = tableData.getIntField("skillIcon", -1));
|
||||
UNUSED_COLUMN(entry.oomSkillID = tableData.getStringField("oomSkillID", ""));
|
||||
UNUSED_COLUMN(entry.oomBehaviorEffectID = tableData.getIntField("oomBehaviorEffectID", -1));
|
||||
UNUSED_COLUMN(entry.castTypeDesc = tableData.getIntField("castTypeDesc", -1));
|
||||
UNUSED_COLUMN(entry.imBonusUI = tableData.getIntField("imBonusUI", -1));
|
||||
UNUSED_COLUMN(entry.lifeBonusUI = tableData.getIntField("lifeBonusUI", -1));
|
||||
UNUSED_COLUMN(entry.armorBonusUI = tableData.getIntField("armorBonusUI", -1));
|
||||
UNUSED_COLUMN(entry.damageUI = tableData.getIntField("damageUI", -1));
|
||||
UNUSED_COLUMN(entry.hideIcon = tableData.getIntField("hideIcon", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED_COLUMN(entry.cancelType = tableData.getIntField("cancelType", -1));
|
||||
|
||||
this->entries.insert(std::make_pair(entry.skillID, entry));
|
||||
//this->entries.push_back(entry);
|
||||
|
@@ -5,24 +5,24 @@
|
||||
|
||||
struct CDSkillBehavior {
|
||||
unsigned int skillID; //!< The Skill ID of the skill
|
||||
UNUSED(unsigned int locStatus); //!< ??
|
||||
UNUSED_COLUMN(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 (?)
|
||||
UNUSED_COLUMN(bool isNpcEditor); //!< ???
|
||||
UNUSED_COLUMN(unsigned int skillIcon); //!< The Skill Icon ID
|
||||
UNUSED_COLUMN(std::string oomSkillID); //!< ???
|
||||
UNUSED_COLUMN(unsigned int oomBehaviorEffectID); //!< ???
|
||||
UNUSED_COLUMN(unsigned int castTypeDesc); //!< The cast type description(?)
|
||||
UNUSED_COLUMN(unsigned int imBonusUI); //!< The imagination bonus of the skill
|
||||
UNUSED_COLUMN(nsigned int lifeBonusUI); //!< The life bonus of the skill
|
||||
UNUSED_COLUMN(unsigned int armorBonusUI); //!< The armor bonus of the skill
|
||||
UNUSED_COLUMN(unsigned int damageUI); //!< ???
|
||||
UNUSED_COLUMN(bool hideIcon); //!< Whether or not to show the icon
|
||||
UNUSED_COLUMN(bool localize); //!< ???
|
||||
UNUSED_COLUMN(std::string gate_version); //!< ???
|
||||
UNUSED_COLUMN(unsigned int cancelType); //!< The cancel type (?)
|
||||
};
|
||||
|
||||
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "CDClientDatabase.h"
|
||||
#include "Singleton.h"
|
||||
#include "DluAssert.h"
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
@@ -15,6 +16,9 @@
|
||||
#endif
|
||||
#include "cpplinq.hpp"
|
||||
|
||||
// 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"
|
||||
|
||||
@@ -23,3 +27,15 @@ 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;
|
||||
};
|
||||
|
@@ -26,25 +26,25 @@ CDZoneTableTable::CDZoneTableTable(void) {
|
||||
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", ""));
|
||||
UNUSED_COLUMN(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
|
||||
UNUSED_COLUMN(entry.mapFolder = tableData.getStringField("mapFolder", ""));
|
||||
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
|
||||
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
|
||||
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
|
||||
UNUSED_COLUMN(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
|
||||
UNUSED_COLUMN(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
|
||||
UNUSED_COLUMN(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", ""));
|
||||
UNUSED_COLUMN(entry.thumbnail = tableData.getStringField("thumbnail", ""));
|
||||
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
|
||||
UNUSED(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
|
||||
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
|
||||
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
|
||||
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
|
||||
UNUSED_COLUMN(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
|
||||
|
||||
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
|
||||
tableData.nextRow();
|
||||
|
@@ -12,25 +12,25 @@ struct CDZoneTable {
|
||||
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); //!< ???
|
||||
UNUSED_COLUMN(std::string DisplayDescription); //!< The display description of the world
|
||||
UNUSED_COLUMN(std::string mapFolder); //!< ???
|
||||
float smashableMinDistance; //!< The minimum smashable distance?
|
||||
float smashableMaxDistance; //!< The maximum smashable distance?
|
||||
UNUSED(std::string mixerProgram); //!< ???
|
||||
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
|
||||
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
|
||||
UNUSED_COLUMN(std::string mixerProgram); //!< ???
|
||||
UNUSED_COLUMN(std::string clientPhysicsFramerate); //!< The client physics framerate
|
||||
UNUSED_COLUMN(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
|
||||
UNUSED_COLUMN(std::string thumbnail); //!< The thumbnail of the world
|
||||
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
|
||||
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
|
||||
UNUSED_COLUMN(bool disableSaveLoc); //!< Disables the saving location?
|
||||
float teamRadius; //!< ???
|
||||
UNUSED(std::string gate_version); //!< The gate version
|
||||
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
UNUSED_COLUMN(std::string gate_version); //!< The gate version
|
||||
UNUSED_COLUMN(bool mountsAllowed); //!< Whether or not mounts are allowed
|
||||
};
|
||||
|
||||
class CDZoneTableTable : public CDTable<CDZoneTableTable> {
|
||||
|
Reference in New Issue
Block a user