Add Animation Table logic

This commit is contained in:
David Markowitz 2023-03-26 03:09:04 -07:00
parent 1e4e1b914c
commit 426bc963fe
40 changed files with 419 additions and 291 deletions

View File

@ -3,8 +3,6 @@
#include <assert.h>
#define _DEBUG
#ifdef _DEBUG
# define DluAssert(expression) assert(expression)
#else

View File

@ -14,7 +14,6 @@ std::vector<MetricVariable> Metrics::m_Variables = {
MetricVariable::CPUTime,
MetricVariable::Sleep,
MetricVariable::Frame,
MetricVariable::Database,
};
void Metrics::AddMeasurement(MetricVariable variable, int64_t value) {

View File

@ -20,7 +20,6 @@ enum class MetricVariable : int32_t
CPUTime,
Sleep,
Frame,
Database,
};
struct Metric

View File

@ -1,11 +1,27 @@
#include "CDActivitiesTable.h"
CDActivitiesTable::CDActivitiesTable() {
CDActivitiesTable::CDActivitiesTable(void) {
// First, get the size of the table
unsigned int size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Activities");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
this->entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
while (!tableData.eof()) {
CDActivities entry;
ActivityID activityId = tableData.getIntField("ActivityID", -1);
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.ActivityID = tableData.getIntField("ActivityID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
entry.minTeams = tableData.getIntField("minTeams", -1);
entry.maxTeams = tableData.getIntField("maxTeams", -1);
@ -13,26 +29,34 @@ CDActivitiesTable::CDActivitiesTable() {
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
entry.waitTime = tableData.getIntField("waitTime", -1);
entry.startDelay = tableData.getIntField("startDelay", -1);
UNUSED_COLUMN(entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1));
entry.requiresUniqueData = tableData.getIntField("requiresUniqueData", -1);
entry.leaderboardType = tableData.getIntField("leaderboardType", -1);
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1));
entry.localize = tableData.getIntField("localize", -1);
entry.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
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.showUIRewards = tableData.getIntField("showUIRewards", -1);
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1);
entry.gate_version = tableData.getStringField("gate_version", "");
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1);
UNUSED_COLUMN(entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f));
auto insertedElement = this->entries.insert_or_assign(activityId, entry);
DluAssert(insertedElement.second == true);
entry.optionalPercentage = tableData.getFloatField("optionalPercentage", -1.0f);
this->entries.push_back(entry);
tableData.nextRow();
}
tableData.finalize();
}
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::Query(std::function<bool(CDActivities)> predicate) {
std::vector<CDActivities> data = cpplinq::from(this->entries)
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
}
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
return this->entries;
}

View File

@ -1,37 +1,38 @@
#pragma once
// Custom Classes
#include "CDTable.h"
typedef uint32_t ActivityID;
struct CDActivities {
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);
unsigned int ActivityID;
unsigned int locStatus;
unsigned int instanceMapID;
unsigned int minTeams;
unsigned int maxTeams;
unsigned int minTeamSize;
unsigned int maxTeamSize;
unsigned int waitTime;
unsigned int startDelay;
bool requiresUniqueData;
unsigned int leaderboardType;
bool localize;
int optionalCostLOT;
int optionalCostCount;
bool showUIRewards;
unsigned int CommunityActivityFlagID;
std::string gate_version;
bool noTeamLootOnDeath;
UNUSED_COLUMN(float optionalPercentage);
float optionalPercentage;
};
typedef LookupResult<CDActivities> CDActivitiesResult;
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
private:
std::map<ActivityID, CDActivities> entries;
std::vector<CDActivities> entries;
public:
CDActivitiesTable();
// Queries the table with a custom "where" clause
CDActivitiesResult GetActivity(ActivityID predicate);
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
std::vector<CDActivities> GetEntries(void) const;
};

View File

@ -4,13 +4,13 @@
#include "CDTable.h"
struct CDActivityRewards {
unsigned int objectTemplate;
unsigned int ActivityRewardIndex;
int activityRating;
unsigned int LootMatrixIndex;
unsigned int CurrencyIndex;
unsigned int ChallengeRating;
std::string description;
unsigned int objectTemplate; //!< The object template (?)
unsigned int ActivityRewardIndex; //!< The activity reward index
int activityRating; //!< The activity rating
unsigned int LootMatrixIndex; //!< The loot matrix index
unsigned int CurrencyIndex; //!< The currency index
unsigned int ChallengeRating; //!< The challenge rating
std::string description; //!< The description
};
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {

View File

@ -2,7 +2,7 @@
#include "GeneralUtils.h"
#include "Game.h"
bool CDAnimationsTable::CacheData(CppSQLite3Statement queryToCache) {
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;
@ -16,15 +16,15 @@ bool CDAnimationsTable::CacheData(CppSQLite3Statement queryToCache) {
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", 0);
entry.max_loops = tableData.getIntField("max_loops", 0);
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);
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", 0.0f);
entry.blendTime = tableData.getFloatField("blendTime", 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();
@ -61,18 +61,17 @@ void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID 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());
}
auto randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
for (auto& animationEntry : animationEntry->second) {
randomAnimation -= animationEntry.chance_to_play;

View File

@ -1,7 +1,7 @@
#pragma once
// Custom Classes
#include "CDTable.h"
#include <list>
struct CDAnimation {
// unsigned int animationGroupID;
@ -9,15 +9,15 @@ struct CDAnimation {
// The above two are a pair to represent a primary key in the map.
std::string animation_name; //!< The animation name
float chance_to_play; //!< The chance to play the animation
unsigned int min_loops; //!< The minimum number of loops
unsigned int max_loops; //!< The maximum number of loops
UNUSED_COLUMN(unsigned int min_loops;) //!< The minimum number of loops
UNUSED_COLUMN(unsigned int max_loops;) //!< The maximum number of loops
float animation_length; //!< The animation length
bool hideEquip; //!< Whether or not to hide the equip
bool ignoreUpperBody; //!< Whether or not to ignore the upper body
bool restartable; //!< Whether or not the animation is restartable
std::string face_animation_name; //!< The face animation name
float priority; //!< The priority
float blendTime; //!< The blend time
UNUSED_COLUMN(bool hideEquip;) //!< Whether or not to hide the equip
UNUSED_COLUMN(bool ignoreUpperBody;) //!< Whether or not to ignore the upper body
UNUSED_COLUMN(bool restartable;) //!< Whether or not the animation is restartable
UNUSED_COLUMN(std::string face_animation_name;) //!< The face animation name
UNUSED_COLUMN(float priority;) //!< The priority
UNUSED_COLUMN(float blendTime;) //!< The blend time
};
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
@ -27,13 +27,40 @@ class CDAnimationsTable : public CDTable<CDAnimationsTable> {
typedef std::string AnimationID;
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
public:
CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
/**
* Given an animationType and the previousAnimationName played, return the next animationType to play.
* If there are more than 1 animationTypes that can be played, one is selected at random but also does not allow
* the previousAnimationName to be played twice.
*
* @param animationType The animationID to lookup
* @param previousAnimationName The previously played animation
* @param animationGroupID The animationGroupID to lookup
* @return CDAnimationLookupResult
*/
[[nodiscard]] CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
/**
* Cache a full AnimationGroup by its ID.
*/
void CacheAnimationGroup(AnimationGroupID animationGroupID);
private:
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.
* Cache all animations given a premade key
*/
std::map<CDAnimationKey, std::vector<CDAnimation>> animations;
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;
};

View File

@ -1,31 +1,93 @@
#include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.h"
#include "dLogger.h"
#include "Game.h"
uint64_t CalculateId(uint64_t lhs, uint64_t rhs) {
return (lhs << 32) | rhs;
}
#define CDCLIENT_CACHE_ALL
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);
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
auto insertedEntry = this->mappedEntries.insert_or_assign(CalculateId(id, static_cast<uint64_t>(component_type)), component_id);
DluAssert(insertedEntry.second == true);
}
#ifdef CDCLIENT_CACHE_ALL
// First, get the size of the table
unsigned int size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
CDComponentsRegistryTable::CDComponentsRegistryTable() {
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
//this->entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
while (!tableData.eof()) {
ReadRow(tableData);
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1);
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
tableData.nextRow();
}
tableData.finalize();
#endif
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
const auto iter = this->mappedEntries.find(CalculateId(id, static_cast<uint64_t>(componentType)));
return iter != this->mappedEntries.end() ? iter->second : 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
}

View File

@ -1,15 +1,21 @@
#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;
};

View File

@ -3,7 +3,8 @@
CDItemComponent CDItemComponentTable::Default = {};
CDItemComponentTable::CDItemComponentTable() {
//! Constructor
CDItemComponentTable::CDItemComponentTable(void) {
Default = CDItemComponent();
#ifdef CDCLIENT_CACHE_ALL
@ -54,13 +55,13 @@ CDItemComponentTable::CDItemComponentTable() {
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
UNUSED_COLUMN(entry.audioEventUse = tableData.getStringField("audioEventUse", "");)
entry.audioEventUse = tableData.getStringField("audioEventUse", "");
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");)
entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", "");
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
UNUSED_COLUMN(entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");)
entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
@ -73,8 +74,8 @@ CDItemComponentTable::CDItemComponentTable() {
#endif
}
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int id) {
const auto& it = this->entries.find(id);
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
const auto& it = this->entries.find(skillID);
if (it != this->entries.end()) {
return it->second;
}
@ -82,11 +83,11 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int i
#ifndef CDCLIENT_CACHE_ALL
std::stringstream query;
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(id);
query << "SELECT * FROM ItemComponent WHERE id = " << std::to_string(skillID);
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
if (tableData.eof()) {
entries.insert(std::make_pair(id, Default));
entries.insert(std::make_pair(skillID, Default));
return Default;
}
@ -124,13 +125,13 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int i
entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", "");
UNUSED_COLUMN(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
UNUSED(entry.audioEventUse = tableData.getStringField("audioEventUse", ""));
entry.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -1);
UNUSED_COLUMN(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
UNUSED(entry.audioEquipMetaEventSet = tableData.getStringField("audioEquipMetaEventSet", ""));
entry.currencyCosts = tableData.getStringField("currencyCosts", "");
UNUSED_COLUMN(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
UNUSED(entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""));
entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
@ -139,7 +140,7 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int i
tableData.nextRow();
}
const auto& it2 = this->entries.find(id);
const auto& it2 = this->entries.find(skillID);
if (it2 != this->entries.end()) {
return it2->second;
}
@ -168,3 +169,4 @@ std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDIt
return currencies;
}

View File

@ -5,60 +5,60 @@
#include "dCommonVars.h"
struct CDItemComponent {
uint32_t id; //!< The Component ID
unsigned int id; //!< The Component ID
std::string equipLocation; //!< The equip location
uint32_t baseValue; //!< The monetary base value of the item
unsigned int baseValue; //!< The monetary base value of the item
bool isKitPiece; //!< Whether or not the item belongs to a kit
uint32_t rarity; //!< The rarity of the item
uint32_t itemType; //!< The item type
unsigned int rarity; //!< The rarity of the item
unsigned int itemType; //!< The item type
int64_t itemInfo; //!< The item info
bool inLootTable; //!< Whether or not the item is in a loot table
bool inVendor; //!< Whether or not the item is in a vendor inventory
bool isUnique; //!< ???
bool isBOP; //!< ???
bool isBOE; //!< ???
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
unsigned int reqFlagID; //!< User must have completed this flag to get the item
unsigned int reqSpecialtyID; //!< ???
unsigned int reqSpecRank; //!< ???
unsigned int reqAchievementID; //!< The required achievement must be completed
unsigned int stackSize; //!< The stack size of the item
unsigned int color1; //!< Something to do with item color...
unsigned int decal; //!< The decal of the item
unsigned int offsetGroupID; //!< Something to do with group IDs
unsigned int buildTypes; //!< Something to do with building
std::string reqPrecondition; //!< The required precondition
uint32_t animationFlag; //!< The Animation Flag
uint32_t equipEffects; //!< The effect played when the item is equipped
unsigned int animationFlag; //!< The Animation Flag
unsigned int equipEffects; //!< The effect played when the item is equipped
bool readyForQA; //!< ???
uint32_t itemRating; //!< ???
unsigned int itemRating; //!< ???
bool isTwoHanded; //!< Whether or not the item is double handed
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; //!< ???
unsigned int minNumRequired; //!< Maybe the minimum number required for a mission, or to own this object?
unsigned int delResIndex; //!< ???
unsigned int currencyLOT; //!< ???
unsigned int altCurrencyCost; //!< ???
std::string subItems; //!< A comma seperate string of sub items (maybe for multi-itemed things like faction test gear set)
UNUSED_COLUMN(std::string audioEventUse); //!< ???
UNUSED(std::string audioEventUse); //!< ???
bool noEquipAnimation; //!< Whether or not there is an equip animation
uint32_t commendationLOT; //!< The commendation LOT
uint32_t commendationCost; //!< The commendation cost
UNUSED_COLUMN(std::string audioEquipMetaEventSet); //!< ???
unsigned int commendationLOT; //!< The commendation LOT
unsigned int commendationCost; //!< The commendation cost
UNUSED(std::string audioEquipMetaEventSet); //!< ???
std::string currencyCosts; //!< Used for crafting
UNUSED_COLUMN(std::string ingredientInfo); //!< Unused
uint32_t locStatus; //!< ???
uint32_t forgeType; //!< Forge Type
UNUSED(std::string ingredientInfo); //!< Unused
unsigned int locStatus; //!< ???
unsigned int forgeType; //!< Forge Type
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
};
class CDItemComponentTable : public CDTable<CDItemComponentTable> {
private:
std::map<uint32_t, CDItemComponent> entries;
std::map<unsigned int, CDItemComponent> entries;
public:
CDItemComponentTable();
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
// Gets an entry by ID
const CDItemComponent& GetItemComponentByID(uint32_t id);
const CDItemComponent& GetItemComponentByID(unsigned int skillID);
static CDItemComponent Default;
};

View File

@ -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_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
this->entries.push_back(entry);
tableData.nextRow();

View File

@ -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_COLUMN(std::string gate_version); //!< The Gate Version
UNUSED(std::string gate_version); //!< The Gate Version
};
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {

View File

@ -22,18 +22,18 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
while (!tableData.eof()) {
CDMissionTasks entry;
entry.id = tableData.getIntField("id", -1);
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.taskType = tableData.getIntField("taskType", -1);
entry.target = tableData.getIntField("target", -1);
entry.targetGroup = tableData.getStringField("targetGroup", "");
entry.targetValue = tableData.getIntField("targetValue", -1);
entry.taskParam1 = tableData.getStringField("taskParam1", "");
UNUSED_COLUMN(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
UNUSED_COLUMN(entry.IconID = tableData.getIntField("IconID", -1));
UNUSED(entry.largeTaskIcon = tableData.getStringField("largeTaskIcon", ""));
UNUSED(entry.IconID = tableData.getIntField("IconID", -1));
entry.uid = tableData.getIntField("uid", -1);
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", ""));
UNUSED(entry.largeTaskIconID = tableData.getIntField("largeTaskIconID", -1));
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
this->entries.push_back(entry);
tableData.nextRow();

View File

@ -5,18 +5,18 @@
struct CDMissionTasks {
unsigned int id; //!< The Mission ID that the task belongs to
UNUSED_COLUMN(unsigned int locStatus); //!< ???
UNUSED(unsigned int locStatus); //!< ???
unsigned int taskType; //!< The task type
unsigned int target; //!< The mission target
std::string targetGroup; //!< The mission target group
int targetValue; //!< The target value
std::string taskParam1; //!< The task param 1
UNUSED_COLUMN(std::string largeTaskIcon); //!< ???
UNUSED_COLUMN(unsigned int IconID); //!< ???
UNUSED(std::string largeTaskIcon); //!< ???
UNUSED(unsigned int IconID); //!< ???
unsigned int uid; //!< ???
UNUSED_COLUMN(unsigned int largeTaskIconID); //!< ???
UNUSED_COLUMN(bool localize); //!< Whether or not the task should be localized
UNUSED_COLUMN(std::string gate_version); //!< ???
UNUSED(unsigned int largeTaskIconID); //!< ???
UNUSED(bool localize); //!< Whether or not the task should be localized
UNUSED(std::string gate_version); //!< ???
};
class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {

View File

@ -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_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED_COLUMN(entry.HUDStates = tableData.getStringField("HUDStates", ""));
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
this->entries.push_back(entry);

View File

@ -54,9 +54,9 @@ struct CDMissions {
bool isRandom; //!< ???
std::string randomPool; //!< ???
int UIPrereqID; //!< ???
UNUSED_COLUMN(std::string gate_version); //!< The gate version
UNUSED_COLUMN(std::string HUDStates); //!< ???
UNUSED_COLUMN(int locStatus); //!< ???
UNUSED(std::string gate_version); //!< The gate version
UNUSED(std::string HUDStates); //!< ???
UNUSED(int locStatus); //!< ???
int reward_bankinventory; //!< The amount of bank space this mission rewards
};

View File

@ -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_COLUMN(entry.placeable = tableData.getIntField("placeable", -1));
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
entry.type = tableData.getStringField("type", "");
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", ""));
UNUSED(ntry.description = tableData.getStringField(4, ""));
UNUSED(entry.localize = tableData.getIntField("localize", -1));
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
UNUSED(entry.displayName = tableData.getStringField("displayName", ""));
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
UNUSED_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));
UNUSED(entry.nametag = tableData.getIntField("nametag", -1));
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
this->entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();

View File

@ -6,18 +6,18 @@
struct CDObjects {
unsigned int id; //!< The LOT of the object
std::string name; //!< The internal name of the object
UNUSED_COLUMN(unsigned int placeable); //!< Whether or not the object is placable
UNUSED(unsigned int placeable); //!< Whether or not the object is placable
std::string type; //!< The object type
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
UNUSED(std::string description); //!< An internal description of the object
UNUSED(unsigned int localize); //!< Whether or not the object should localize
UNUSED(unsigned int npcTemplateID); //!< Something related to NPCs...
UNUSED(std::string displayName); //!< The display name of the object
float interactionDistance; //!< The interaction distance of the object
UNUSED_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
UNUSED(unsigned int nametag); //!< ???
UNUSED(std::string _internalNotes); //!< Some internal notes (rarely used)
UNUSED(unsigned int locStatus); //!< ???
UNUSED(std::string gate_version); //!< The gate version for the object
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
};
class CDObjectsTable : public CDTable<CDObjectsTable> {

View File

@ -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_COLUMN(entry->jump = tableData.getIntField("jump", -1) != 0);
UNUSED_COLUMN(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0);
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
entry->speed = tableData.getFloatField("speed", -1);
UNUSED_COLUMN(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
UNUSED(entry->rotSpeed = tableData.getFloatField("rotSpeed", -1));
entry->playerHeight = tableData.getFloatField("playerHeight");
entry->playerRadius = tableData.getFloatField("playerRadius");
entry->pcShapeType = tableData.getIntField("pcShapeType");
entry->collisionGroup = tableData.getIntField("collisionGroup");
UNUSED_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"));
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed"));
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
UNUSED(entry->friction = tableData.getFloatField("friction"));
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
m_entries.insert(std::make_pair(entry->id, entry));
tableData.nextRow();

View File

@ -6,19 +6,19 @@ struct CDPhysicsComponent {
int id;
bool bStatic;
std::string physicsAsset;
UNUSED_COLUMN(bool jump);
UNUSED_COLUMN(bool doublejump);
UNUSED(bool jump);
UNUSED(bool doublejump);
float speed;
UNUSED_COLUMN(float rotSpeed);
UNUSED(float rotSpeed);
float playerHeight;
float playerRadius;
int pcShapeType;
int collisionGroup;
UNUSED_COLUMN(float airSpeed);
UNUSED_COLUMN(std::string boundaryAsset);
UNUSED_COLUMN(float jumpAirSpeed);
UNUSED_COLUMN(float friction);
UNUSED_COLUMN(std::string gravityVolumeAsset);
UNUSED(float airSpeed);
UNUSED(std::string boundaryAsset);
UNUSED(float jumpAirSpeed);
UNUSED(float friction);
UNUSED(std::string gravityVolumeAsset);
};
class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {

View File

@ -24,24 +24,24 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
while (!tableData.eof()) {
CDSkillBehavior entry;
entry.skillID = tableData.getIntField("skillID", -1);
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.behaviorID = tableData.getIntField("behaviorID", -1);
entry.imaginationcost = tableData.getIntField("imaginationcost", -1);
entry.cooldowngroup = tableData.getIntField("cooldowngroup", -1);
entry.cooldown = tableData.getFloatField("cooldown", -1.0f);
UNUSED_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));
UNUSED(entry.isNpcEditor = tableData.getIntField("isNpcEditor", -1) == 1 ? true : false);
UNUSED(entry.skillIcon = tableData.getIntField("skillIcon", -1));
UNUSED(entry.oomSkillID = tableData.getStringField("oomSkillID", ""));
UNUSED(entry.oomBehaviorEffectID = tableData.getIntField("oomBehaviorEffectID", -1));
UNUSED(entry.castTypeDesc = tableData.getIntField("castTypeDesc", -1));
UNUSED(entry.imBonusUI = tableData.getIntField("imBonusUI", -1));
UNUSED(entry.lifeBonusUI = tableData.getIntField("lifeBonusUI", -1));
UNUSED(entry.armorBonusUI = tableData.getIntField("armorBonusUI", -1));
UNUSED(entry.damageUI = tableData.getIntField("damageUI", -1));
UNUSED(entry.hideIcon = tableData.getIntField("hideIcon", -1) == 1 ? true : false);
UNUSED(entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.cancelType = tableData.getIntField("cancelType", -1));
this->entries.insert(std::make_pair(entry.skillID, entry));
//this->entries.push_back(entry);

View File

@ -5,24 +5,24 @@
struct CDSkillBehavior {
unsigned int skillID; //!< The Skill ID of the skill
UNUSED_COLUMN(unsigned int locStatus); //!< ??
UNUSED(unsigned int locStatus); //!< ??
unsigned int behaviorID; //!< The Behavior ID of the skill
unsigned int imaginationcost; //!< The imagination cost of the skill
unsigned int cooldowngroup; //!< The cooldown group ID of the skill
float cooldown; //!< The cooldown time of the skill
UNUSED_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 (?)
UNUSED(bool isNpcEditor); //!< ???
UNUSED(unsigned int skillIcon); //!< The Skill Icon ID
UNUSED(std::string oomSkillID); //!< ???
UNUSED(unsigned int oomBehaviorEffectID); //!< ???
UNUSED(unsigned int castTypeDesc); //!< The cast type description(?)
UNUSED(unsigned int imBonusUI); //!< The imagination bonus of the skill
UNUSED(nsigned int lifeBonusUI); //!< The life bonus of the skill
UNUSED(unsigned int armorBonusUI); //!< The armor bonus of the skill
UNUSED(unsigned int damageUI); //!< ???
UNUSED(bool hideIcon); //!< Whether or not to show the icon
UNUSED(bool localize); //!< ???
UNUSED(std::string gate_version); //!< ???
UNUSED(unsigned int cancelType); //!< The cancel type (?)
};
class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {

View File

@ -16,6 +16,9 @@
#endif
#include "cpplinq.hpp"
// Used for legacy
#define UNUSED(x)
// Enable this to skip some unused columns in some tables
#define UNUSED_COLUMN(v)

View File

@ -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_COLUMN(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
UNUSED_COLUMN(entry.mapFolder = tableData.getStringField("mapFolder", ""));
UNUSED(entry.DisplayDescription = tableData.getStringField("DisplayDescription", ""));
UNUSED(entry.mapFolder = tableData.getStringField("mapFolder", ""));
entry.smashableMinDistance = tableData.getFloatField("smashableMinDistance", -1.0f);
entry.smashableMaxDistance = tableData.getFloatField("smashableMaxDistance", -1.0f);
UNUSED_COLUMN(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
UNUSED_COLUMN(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
UNUSED_COLUMN(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
UNUSED(entry.mixerProgram = tableData.getStringField("mixerProgram", ""));
UNUSED(entry.clientPhysicsFramerate = tableData.getStringField("clientPhysicsFramerate", ""));
UNUSED(entry.serverPhysicsFramerate = tableData.getStringField("serverPhysicsFramerate", ""));
entry.zoneControlTemplate = tableData.getIntField("zoneControlTemplate", -1);
entry.widthInChunks = tableData.getIntField("widthInChunks", -1);
entry.heightInChunks = tableData.getIntField("heightInChunks", -1);
entry.petsAllowed = tableData.getIntField("petsAllowed", -1) == 1 ? true : false;
entry.localize = tableData.getIntField("localize", -1) == 1 ? true : false;
entry.fZoneWeight = tableData.getFloatField("fZoneWeight", -1.0f);
UNUSED_COLUMN(entry.thumbnail = tableData.getStringField("thumbnail", ""));
UNUSED(entry.thumbnail = tableData.getStringField("thumbnail", ""));
entry.PlayerLoseCoinsOnDeath = tableData.getIntField("PlayerLoseCoinsOnDeath", -1) == 1 ? true : false;
UNUSED_COLUMN(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
UNUSED(entry.disableSaveLoc = tableData.getIntField("disableSaveLoc", -1) == 1 ? true : false);
entry.teamRadius = tableData.getFloatField("teamRadius", -1.0f);
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED_COLUMN(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.mountsAllowed = tableData.getIntField("mountsAllowed", -1) == 1 ? true : false);
this->m_Entries.insert(std::make_pair(entry.zoneID, entry));
tableData.nextRow();

View File

@ -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_COLUMN(std::string DisplayDescription); //!< The display description of the world
UNUSED_COLUMN(std::string mapFolder); //!< ???
UNUSED(std::string DisplayDescription); //!< The display description of the world
UNUSED(std::string mapFolder); //!< ???
float smashableMinDistance; //!< The minimum smashable distance?
float smashableMaxDistance; //!< The maximum smashable distance?
UNUSED_COLUMN(std::string mixerProgram); //!< ???
UNUSED_COLUMN(std::string clientPhysicsFramerate); //!< The client physics framerate
UNUSED_COLUMN(std::string serverPhysicsFramerate); //!< The server physics framerate
UNUSED(std::string mixerProgram); //!< ???
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate
unsigned int zoneControlTemplate; //!< The Zone Control template
unsigned int widthInChunks; //!< The width of the world in chunks
unsigned int heightInChunks; //!< The height of the world in chunks
bool petsAllowed; //!< Whether or not pets are allowed in the world
bool localize; //!< Whether or not the world should be localized
float fZoneWeight; //!< ???
UNUSED_COLUMN(std::string thumbnail); //!< The thumbnail of the world
UNUSED(std::string thumbnail); //!< The thumbnail of the world
bool PlayerLoseCoinsOnDeath; //!< Whether or not the user loses coins on death
UNUSED_COLUMN(bool disableSaveLoc); //!< Disables the saving location?
UNUSED(bool disableSaveLoc); //!< Disables the saving location?
float teamRadius; //!< ???
UNUSED_COLUMN(std::string gate_version); //!< The gate version
UNUSED_COLUMN(bool mountsAllowed); //!< Whether or not mounts are allowed
UNUSED(std::string gate_version); //!< The gate version
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
};
class CDZoneTableTable : public CDTable<CDZoneTableTable> {

View File

@ -593,9 +593,9 @@ void Entity::Initialize() {
m_Components.insert(std::make_pair(eReplicaComponentType::BOUNCER, comp));
}
int32_t renderaComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
if ((renderaComponentId > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this, renderaComponentId);
int32_t renderComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
if ((renderComponentId > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this, renderComponentId);
m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render));
}

View File

@ -277,11 +277,13 @@ void LeaderboardManager::SendLeaderboard(uint32_t gameID, InfoType infoType, boo
}
LeaderboardType LeaderboardManager::GetLeaderboardType(uint32_t gameID) {
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
auto activityResult = activitiesTable->GetActivity(gameID);
auto* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
std::vector<CDActivities> activities = activitiesTable->Query([=](const CDActivities& entry) {
return (entry.ActivityID == gameID);
});
if (activityResult.FoundData()) {
return static_cast<LeaderboardType>(activityResult.Data().leaderboardType);
for (const auto& activity : activities) {
return static_cast<LeaderboardType>(activity.leaderboardType);
}
return LeaderboardType::None;

View File

@ -18,6 +18,8 @@ std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component(parent) {
m_Effects = std::vector<Effect*>();
m_LastAnimationName = "";
if (componentId == -1) return;
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
query.bind(1, componentId);
auto result = query.execQuery();
@ -210,23 +212,21 @@ float RenderComponent::GetAnimationTime(Entity* self, const std::string& animati
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
if (!self) return 0.0f;
float returnlength = 0.0f;
if (!self) return returnlength;
auto* renderComponent = self->GetComponent<RenderComponent>();
if (!renderComponent) return 0.0f;
if (!renderComponent) return returnlength;
Game::logger->Log("RenderComponent", "looking up animation %s playing anim %i priority %f scale %f", animation.c_str(), sendAnimation, priority, scale);
auto* animationsTable = CDClientManager::Instance().GetTable<CDAnimationsTable>();
for (auto& groupId : renderComponent->m_animationGroupIds) {
Game::logger->Log("RenderComponent", "checking id %i with previous being %s", groupId, renderComponent->GetLastAnimationName().c_str());
auto animationGroup = animationsTable->GetAnimation(animation, renderComponent->GetLastAnimationName(), groupId);
if (animationGroup.FoundData()) {
auto data = animationGroup.Data();
Game::logger->Log("RenderComponent", "animation %s priority %f length %f", data.animation_name.c_str(), data.priority, data.animation_length);
if (sendAnimation) GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animation), priority, scale);
renderComponent->SetLastAnimationName(data.animation_name);
return data.animation_length;
returnlength = data.animation_length;
}
}
Game::logger->Log("RenderComponent", "unable to find animation %s for lot %i", animation.c_str(), self->GetLOT());
return 0.0f;
if (sendAnimation) GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animation), priority, scale);
if (returnlength == 0.0f) Game::logger->Log("RenderComponent", "WARNING: Unable to find animation %s for lot %i in any group.", animation.c_str(), self->GetLOT());
return returnlength;
}

View File

@ -104,6 +104,22 @@ public:
*/
std::vector<Effect*>& GetEffects();
/**
* Verifies that an animation can be played on this entity by checking
* if it has the animation assigned to its group. If it does, the animation is echo'd
* down to all clients to be played and the duration of the played animation is returned.
* If the animation did not exist or the function was called in an invalid state, 0 is returned.
*
* The logic here matches the exact client logic.
*
* @param self The entity that wants to play an animation
* @param animation The animation_type (animationID in the client) to be played.
* @param sendAnimation Whether or not to echo the animation down to all clients.
* @param priority The priority of the animation. Only used if sendAnimation is true.
* @param scale The scale of the animation. Only used if sendAnimation is true.
*
* @return The duration of the animation that was played.
*/
static float DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority = 0.0f, float scale = 1.0f);
static float PlayAnimation(Entity* self, const std::u16string& animation, float priority = 0.0f, float scale = 1.0f);

View File

@ -26,13 +26,13 @@
#include "CDActivityRewardsTable.h"
#include "CDActivitiesTable.h"
ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activityID): Component(parent) {
ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activityID) : Component(parent) {
m_ActivityID = activityID;
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
auto activityResult = activitiesTable->GetActivity(m_ActivityID);
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
if (activityResult.FoundData()) {
m_ActivityInfo = activityResult.Data();
for (CDActivities activity : activities) {
m_ActivityInfo = activity;
const auto mapID = m_ActivityInfo.instanceMapID;
@ -57,7 +57,6 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
if (destroyableComponent) {
// check for LMIs and set the loot LMIs
Game::logger->Log("ScriptedActivityComponent", "i am %i with lmi %i", m_Parent->GetLOT(), destroyableComponent->GetLootMatrixID());
CDActivityRewardsTable* activityRewardsTable = CDClientManager::Instance().GetTable<CDActivityRewardsTable>();
std::vector<CDActivityRewards> activityRewards = activityRewardsTable->Query([=](CDActivityRewards entry) {return (entry.LootMatrixIndex == destroyableComponent->GetLootMatrixID()); });
@ -65,13 +64,13 @@ ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int activit
if (activityRewards.size() > 0) {
startingLMI = activityRewards[0].LootMatrixIndex;
Game::logger->Log("ScriptedActivityComponent", "index 0 is %i %i", activityRewards[0].LootMatrixIndex, activityRewards[0].objectTemplate);
}
if (startingLMI > 0) {
// now time for bodge :)
std::vector<CDActivityRewards> objectTemplateActivities = activityRewardsTable->Query([=](CDActivityRewards entry) {return (activityRewards[0].objectTemplate == entry.objectTemplate); });
for (const auto& item : objectTemplateActivities) {
Game::logger->Log("ScriptedActivityComponent", "%i added loot matrix with rating %i index %i objectTemplate %i", m_Parent->GetLOT(), item.activityRating, item.LootMatrixIndex, item.objectTemplate);
if (item.activityRating > 0 && item.activityRating < 5) {
m_ActivityLootMatrices.insert({ item.activityRating, item.LootMatrixIndex });
}
@ -100,22 +99,21 @@ void ScriptedActivityComponent::Serialize(RakNet::BitStream* outBitStream, bool
void ScriptedActivityComponent::ReloadConfig() {
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
auto activityResult = activitiesTable->GetActivity(m_ActivityID);
if (activityResult.FoundData()) {
auto data = activityResult.Data();
auto mapID = data.instanceMapID;
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
for (auto activity : activities) {
auto mapID = m_ActivityInfo.instanceMapID;
if ((mapID == 1203 || mapID == 1261 || mapID == 1303 || mapID == 1403) && Game::config->GetValue("solo_racing") == "1") {
m_ActivityInfo.minTeamSize = 1;
m_ActivityInfo.minTeams = 1;
} else {
m_ActivityInfo.minTeamSize = data.minTeamSize;
m_ActivityInfo.minTeams = data.minTeams;
m_ActivityInfo.minTeamSize = activity.minTeamSize;
m_ActivityInfo.minTeams = activity.minTeams;
}
}
}
void ScriptedActivityComponent::HandleMessageBoxResponse(Entity* player, const std::string& id) {
if (m_ActivityID == 103) {
if (m_ActivityInfo.ActivityID == 103) {
return;
}
@ -127,7 +125,7 @@ void ScriptedActivityComponent::HandleMessageBoxResponse(Entity* player, const s
}
void ScriptedActivityComponent::PlayerJoin(Entity* player) {
if (m_ActivityID == 103 || PlayerIsInQueue(player) || !IsValidActivity(player)) {
if (m_ActivityInfo.ActivityID == 103 || PlayerIsInQueue(player) || !IsValidActivity(player)) {
return;
}
@ -392,7 +390,7 @@ void ScriptedActivityComponent::PlayerReady(Entity* player, bool bReady) {
}
ActivityInstance* ScriptedActivityComponent::NewInstance() {
auto* instance = new ActivityInstance(m_Parent, this, m_ActivityInfo);
auto* instance = new ActivityInstance(m_Parent, m_ActivityInfo);
m_Instances.push_back(instance);
return instance;
}
@ -559,12 +557,12 @@ void ActivityInstance::StartZone() {
void ActivityInstance::RewardParticipant(Entity* participant) {
auto* missionComponent = participant->GetComponent<MissionComponent>();
if (missionComponent) {
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_OwningComponent->GetActivityID());
missionComponent->Progress(eMissionTaskType::ACTIVITY, m_ActivityInfo.ActivityID);
}
// First, get the activity data
auto* activityRewardsTable = CDClientManager::Instance().GetTable<CDActivityRewardsTable>();
std::vector<CDActivityRewards> activityRewards = activityRewardsTable->Query([=](CDActivityRewards entry) { return (entry.objectTemplate == m_OwningComponent->GetActivityID()); });
std::vector<CDActivityRewards> activityRewards = activityRewardsTable->Query([=](CDActivityRewards entry) { return (entry.objectTemplate == m_ActivityInfo.ActivityID); });
if (!activityRewards.empty()) {
uint32_t minCoins = 0;

View File

@ -15,18 +15,13 @@
#include "CDActivitiesTable.h"
class ScriptedActivityComponent;
/**
* Represents an instance of an activity, having participants and score
*/
class ActivityInstance {
public:
ActivityInstance(Entity* parent, ScriptedActivityComponent* parentComponent, CDActivities activityInfo) {
m_Parent = parent;
m_OwningComponent = parentComponent;
m_ActivityInfo = activityInfo;
};
ActivityInstance(Entity* parent, CDActivities activityInfo) { m_Parent = parent; m_ActivityInfo = activityInfo; };
//~ActivityInstance();
/**
* Adds an entity to this activity
@ -93,11 +88,6 @@ private:
*/
Entity* m_Parent;
/**
* The component that owns this activity (the ScriptedActivityComponent)
*/
ScriptedActivityComponent* m_OwningComponent;
/**
* All the participants of this activity
*/
@ -222,7 +212,7 @@ public:
* Returns the ID of this activity
* @return the ID of this activity
*/
int GetActivityID() { return m_ActivityID; }
int GetActivityID() { return m_ActivityInfo.ActivityID; }
/**
* Returns if this activity has a lobby, e.g. if it needs to instance players to some other map

View File

@ -17,7 +17,6 @@
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eReplicaComponentType.h"
#include "Metrics.hpp"
LootGenerator::LootGenerator() {
CDLootTableTable* lootTableTable = CDClientManager::Instance().GetTable<CDLootTableTable>();

View File

@ -334,7 +334,8 @@ int main(int argc, char** argv) {
if (Game::config->GetValue("prestart_servers") != "" && Game::config->GetValue("prestart_servers") == "1") {
StartChatServer();
Game::im->GetInstance(1800, false, 0);
Game::im->GetInstance(0, false, 0);
Game::im->GetInstance(1000, false, 0);
StartAuthServer();
}

View File

@ -73,7 +73,7 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
float animationTime = RenderComponent::PlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", animationTime);
self->AddTimer("timeToStunLoop", 1.0f);
auto position = self->GetPosition();
auto forward = self->GetRotation().GetForwardVector();

View File

@ -7,7 +7,10 @@
#include "RenderComponent.h"
void MaestromExtracticatorServer::OnStartup(Entity* self) {
self->AddTimer("PlayFail", RenderComponent::PlayAnimation(self, failAnim));
float animTime = RenderComponent::PlayAnimation(self, failAnim);
if (animTime == 0.0f) animTime = defaultTime;
self->AddTimer("PlayFail", animTime);
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
}

View File

@ -13,5 +13,6 @@ public:
private:
const std::string failAnim = "idle_maelstrom";
const std::string collectAnim = "collect_maelstrom";
const float defaultTime = 4.0f;
const float destroyAfterNoSampleTime = 8.0f;
};

View File

@ -28,9 +28,8 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
true, true, true, true, true, true, true
);
RenderComponent::PlayAnimation(player, u"teledeath", 4.0f);
const auto animTime = 2;
auto animTime = RenderComponent::PlayAnimation(player, u"teledeath", 4.0f);
if (animTime == 0.0f) animTime = 2.0f;
self->AddCallbackTimer(animTime, [this, self, playerID]() {
auto* player = EntityManager::Instance()->GetEntity(playerID);

View File

@ -33,7 +33,6 @@ void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* s
}
const auto& teleIntroAnim = self->GetVar<std::u16string>(u"teleportAnim");
Game::logger->Log("BaseConsoleTeleportServer", "%s",GeneralUtils::UTF16ToWTF8(teleIntroAnim).c_str());
auto animTime = 3.32999992370605f;
if (!teleIntroAnim.empty()) {
animTime = RenderComponent::PlayAnimation(player, teleIntroAnim);