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:
David Markowitz 2023-03-20 06:10:52 -07:00
parent 7671cc6865
commit b432a3f5da
84 changed files with 631 additions and 607 deletions

14
dCommon/DluAssert.h Normal file
View File

@ -0,0 +1,14 @@
#ifndef __DLUASSERT__H__
#define __DLUASSERT__H__
#include <assert.h>
#define _DEBUG
#ifdef _DEBUG
# define DluAssert(expression) assert(expression)
#else
# define DluAssert(expression)
#endif
#endif //!__DLUASSERT__H__

View File

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

View File

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

View File

@ -16,9 +16,6 @@
// Enable this to cache all entries in each table for fast access, comes with more memory cost // Enable this to cache all entries in each table for fast access, comes with more memory cost
//#define CDCLIENT_CACHE_ALL //#define CDCLIENT_CACHE_ALL
// Enable this to skip some unused columns in some tables
#define UNUSED(v)
/*! /*!
\file CDClientDatabase.hpp \file CDClientDatabase.hpp
\brief An interface between the CDClient.sqlite file and the server \brief An interface between the CDClient.sqlite file and the server

View File

@ -40,7 +40,7 @@
CDClientManager::CDClientManager() { CDClientManager::CDClientManager() {
CDActivityRewardsTable::Instance(); CDActivityRewardsTable::Instance();
UNUSED(CDAnimationsTable::Instance()); CDAnimationsTable::Instance();
CDBehaviorParameterTable::Instance(); CDBehaviorParameterTable::Instance();
CDBehaviorTemplateTable::Instance(); CDBehaviorTemplateTable::Instance();
CDComponentsRegistryTable::Instance(); CDComponentsRegistryTable::Instance();

View File

@ -4,6 +4,8 @@
#include "Singleton.h" #include "Singleton.h"
#define UNUSED_TABLE(v)
/** /**
* Initialize the CDClient tables so they are all loaded into memory. * Initialize the CDClient tables so they are all loaded into memory.
*/ */

View File

@ -1,27 +1,11 @@
#include "CDActivitiesTable.h" #include "CDActivitiesTable.h"
CDActivitiesTable::CDActivitiesTable(void) { CDActivitiesTable::CDActivitiesTable() {
// 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"); auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Activities");
while (!tableData.eof()) { while (!tableData.eof()) {
CDActivities entry; CDActivities entry;
entry.ActivityID = tableData.getIntField("ActivityID", -1); ActivityID activityId = tableData.getIntField("ActivityID", -1);
entry.locStatus = tableData.getIntField("locStatus", -1); UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.instanceMapID = tableData.getIntField("instanceMapID", -1); entry.instanceMapID = tableData.getIntField("instanceMapID", -1);
entry.minTeams = tableData.getIntField("minTeams", -1); entry.minTeams = tableData.getIntField("minTeams", -1);
entry.maxTeams = tableData.getIntField("maxTeams", -1); entry.maxTeams = tableData.getIntField("maxTeams", -1);
@ -29,34 +13,26 @@ CDActivitiesTable::CDActivitiesTable(void) {
entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1); entry.maxTeamSize = tableData.getIntField("maxTeamSize", -1);
entry.waitTime = tableData.getIntField("waitTime", -1); entry.waitTime = tableData.getIntField("waitTime", -1);
entry.startDelay = tableData.getIntField("startDelay", -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.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.optionalCostLOT = tableData.getIntField("optionalCostLOT", -1);
entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1); entry.optionalCostCount = tableData.getIntField("optionalCostCount", -1);
entry.showUIRewards = tableData.getIntField("showUIRewards", -1); UNUSED_COLUMN(entry.showUIRewards = tableData.getIntField("showUIRewards", -1));
entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1); UNUSED_COLUMN(entry.CommunityActivityFlagID = tableData.getIntField("CommunityActivityFlagID", -1));
entry.gate_version = tableData.getStringField("gate_version", ""); UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
entry.noTeamLootOnDeath = tableData.getIntField("noTeamLootOnDeath", -1); 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.nextRow();
} }
tableData.finalize(); tableData.finalize();
} }
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) { CDActivitiesResult CDActivitiesTable::GetActivity(ActivityID id) {
const auto foundElement = this->entries.find(id);
std::vector<CDActivities> data = cpplinq::from(this->entries) return foundElement != this->entries.end() ? CDActivitiesResult(foundElement->second) : CDActivitiesResult();
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
} }
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
return this->entries;
}

View File

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

View File

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

View File

@ -1,56 +1,84 @@
#include "CDAnimationsTable.h" #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 do {
unsigned int size = 0; std::string animation_type = tableData.getStringField("animation_type", "");
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations"); DluAssert(!animation_type.empty());
while (!tableSize.eof()) { AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
size = tableSize.getIntField(0, 0); DluAssert(animationGroupID != -1);
tableSize.nextRow(); CDAnimation entry;
}
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", "");
entry.animation_name = tableData.getStringField("animation_name", ""); entry.animation_name = tableData.getStringField("animation_name", "");
entry.chance_to_play = tableData.getFloatField("chance_to_play", -1.0f); entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
entry.min_loops = tableData.getIntField("min_loops", -1); entry.min_loops = tableData.getIntField("min_loops", 0);
entry.max_loops = tableData.getIntField("max_loops", -1); entry.max_loops = tableData.getIntField("max_loops", 0);
entry.animation_length = tableData.getFloatField("animation_length", -1.0f); entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
entry.hideEquip = tableData.getIntField("hideEquip", -1) == 1 ? true : false; entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", -1) == 1 ? true : false; entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;
entry.restartable = tableData.getIntField("restartable", -1) == 1 ? true : false; entry.restartable = tableData.getIntField("restartable", 0) == 1;
entry.face_animation_name = tableData.getStringField("face_animation_name", ""); entry.face_animation_name = tableData.getStringField("face_animation_name", "");
entry.priority = tableData.getFloatField("priority", -1.0f); entry.priority = tableData.getFloatField("priority", 0.0f);
entry.blendTime = tableData.getFloatField("blendTime", -1.0f); entry.blendTime = tableData.getFloatField("blendTime", 0.0f);
this->entries.push_back(entry); this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
tableData.nextRow(); tableData.nextRow();
} } while (!tableData.eof());
tableData.finalize(); tableData.finalize();
return true;
} }
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) { void CDAnimationsTable::CacheAnimations(const CDAnimationKey animationKey) {
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ? and animation_type = ?");
std::vector<CDAnimations> data = cpplinq::from(this->entries) query.bind(1, static_cast<int32_t>(animationKey.second));
>> cpplinq::where(predicate) query.bind(2, animationKey.first.c_str());
>> cpplinq::to_vector(); // If we received a bad lookup, cache it anyways so we do not run the query again.
if (!CacheData(query)) {
return data; this->animations[animationKey];
}
} }
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const { void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
return this->entries; 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();
}

View File

@ -3,9 +3,10 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
struct CDAnimations { struct CDAnimation {
unsigned int animationGroupID; //!< The animation group ID // unsigned int animationGroupID;
std::string animation_type; //!< The animation type // 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 std::string animation_name; //!< The animation name
float chance_to_play; //!< The chance to play the animation float chance_to_play; //!< The chance to play the animation
unsigned int min_loops; //!< The minimum number of loops unsigned int min_loops; //!< The minimum number of loops
@ -19,15 +20,20 @@ struct CDAnimations {
float blendTime; //!< The blend time float blendTime; //!< The blend time
}; };
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
class CDAnimationsTable : public CDTable<CDAnimationsTable> { class CDAnimationsTable : public CDTable<CDAnimationsTable> {
private: typedef int32_t AnimationGroupID;
std::vector<CDAnimations> entries; typedef std::string AnimationID;
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
public: public:
CDAnimationsTable(); CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
// Queries the table with a custom "where" clause void CacheAnimationGroup(AnimationGroupID animationGroupID);
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate); private:
void CacheAnimations(const CDAnimationKey animationKey);
std::vector<CDAnimations> GetEntries(void) const; 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;
}; };

View File

@ -1,93 +1,31 @@
#include "CDComponentsRegistryTable.h" #include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.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 auto insertedEntry = this->mappedEntries.insert_or_assign(CalculateId(id, static_cast<uint64_t>(component_type)), component_id);
// First, get the size of the table DluAssert(insertedEntry.second == true);
unsigned int size = 0; }
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
tableSize.nextRow(); CDComponentsRegistryTable::CDComponentsRegistryTable() {
}
tableSize.finalize();
// Reserve the size
//this->entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry"); auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
while (!tableData.eof()) { while (!tableData.eof()) {
CDComponentsRegistry entry; ReadRow(tableData);
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.nextRow();
} }
tableData.finalize(); tableData.finalize();
#endif
} }
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) { 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)); const auto iter = this->mappedEntries.find(CalculateId(id, static_cast<uint64_t>(componentType)));
return iter != this->mappedEntries.end() ? iter->second : defaultValue;
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,21 +1,15 @@
#pragma once #pragma once
// Custom Classes
#include "CDTable.h" #include "CDTable.h"
enum class eReplicaComponentType : uint32_t; 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> { class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
private:
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
public: public:
CDComponentsRegistryTable(); CDComponentsRegistryTable();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0); 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,8 +3,7 @@
CDItemComponent CDItemComponentTable::Default = {}; CDItemComponent CDItemComponentTable::Default = {};
//! Constructor CDItemComponentTable::CDItemComponentTable() {
CDItemComponentTable::CDItemComponentTable(void) {
Default = CDItemComponent(); Default = CDItemComponent();
#ifdef CDCLIENT_CACHE_ALL #ifdef CDCLIENT_CACHE_ALL
@ -55,13 +54,13 @@ CDItemComponentTable::CDItemComponentTable(void) {
entry.currencyLOT = tableData.getIntField("currencyLOT", -1); entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1); entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", ""); 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.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1); entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -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.currencyCosts = tableData.getStringField("currencyCosts", "");
entry.ingredientInfo = tableData.getStringField("ingredientInfo", ""); UNUSED_COLUMN(entry.ingredientInfo = tableData.getStringField("ingredientInfo", "");)
entry.locStatus = tableData.getIntField("locStatus", -1); entry.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1); entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f); entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
@ -74,8 +73,8 @@ CDItemComponentTable::CDItemComponentTable(void) {
#endif #endif
} }
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) { const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int id) {
const auto& it = this->entries.find(skillID); const auto& it = this->entries.find(id);
if (it != this->entries.end()) { if (it != this->entries.end()) {
return it->second; return it->second;
} }
@ -83,11 +82,11 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
#ifndef CDCLIENT_CACHE_ALL #ifndef CDCLIENT_CACHE_ALL
std::stringstream query; 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()); auto tableData = CDClientDatabase::ExecuteQuery(query.str());
if (tableData.eof()) { if (tableData.eof()) {
entries.insert(std::make_pair(skillID, Default)); entries.insert(std::make_pair(id, Default));
return Default; return Default;
} }
@ -125,13 +124,13 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
entry.currencyLOT = tableData.getIntField("currencyLOT", -1); entry.currencyLOT = tableData.getIntField("currencyLOT", -1);
entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1); entry.altCurrencyCost = tableData.getIntField("altCurrencyCost", -1);
entry.subItems = tableData.getStringField("subItems", ""); 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.noEquipAnimation = tableData.getIntField("noEquipAnimation", -1) == 1 ? true : false;
entry.commendationLOT = tableData.getIntField("commendationLOT", -1); entry.commendationLOT = tableData.getIntField("commendationLOT", -1);
entry.commendationCost = tableData.getIntField("commendationCost", -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", ""); 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.locStatus = tableData.getIntField("locStatus", -1);
entry.forgeType = tableData.getIntField("forgeType", -1); entry.forgeType = tableData.getIntField("forgeType", -1);
entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f); entry.SellMultiplier = tableData.getFloatField("SellMultiplier", -1.0f);
@ -140,7 +139,7 @@ const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int s
tableData.nextRow(); tableData.nextRow();
} }
const auto& it2 = this->entries.find(skillID); const auto& it2 = this->entries.find(id);
if (it2 != this->entries.end()) { if (it2 != this->entries.end()) {
return it2->second; return it2->second;
} }
@ -169,4 +168,3 @@ std::map<LOT, uint32_t> CDItemComponentTable::ParseCraftingCurrencies(const CDIt
return currencies; return currencies;
} }

View File

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

View File

@ -29,7 +29,7 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
entry.maxToDrop = tableData.getIntField("maxToDrop", -1); entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
entry.id = tableData.getIntField("id", -1); entry.id = tableData.getIntField("id", -1);
entry.flagID = tableData.getIntField("flagID", -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); this->entries.push_back(entry);
tableData.nextRow(); 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 maxToDrop; //!< The maximum amount of loot from this matrix to drop
unsigned int id; //!< The ID of the Loot Matrix unsigned int id; //!< The ID of the Loot Matrix
unsigned int flagID; //!< ??? 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> { class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {

View File

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

View File

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

View File

@ -71,9 +71,9 @@ CDMissionsTable::CDMissionsTable(void) {
entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false; entry.isRandom = tableData.getIntField("isRandom", -1) == 1 ? true : false;
entry.randomPool = tableData.getStringField("randomPool", ""); entry.randomPool = tableData.getStringField("randomPool", "");
entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1); entry.UIPrereqID = tableData.getIntField("UIPrereqID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", "")); UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HUDStates = tableData.getStringField("HUDStates", "")); UNUSED_COLUMN(entry.HUDStates = tableData.getStringField("HUDStates", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1)); UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1); entry.reward_bankinventory = tableData.getIntField("reward_bankinventory", -1);
this->entries.push_back(entry); this->entries.push_back(entry);

View File

@ -54,9 +54,9 @@ struct CDMissions {
bool isRandom; //!< ??? bool isRandom; //!< ???
std::string randomPool; //!< ??? std::string randomPool; //!< ???
int UIPrereqID; //!< ??? int UIPrereqID; //!< ???
UNUSED(std::string gate_version); //!< The gate version UNUSED_COLUMN(std::string gate_version); //!< The gate version
UNUSED(std::string HUDStates); //!< ??? UNUSED_COLUMN(std::string HUDStates); //!< ???
UNUSED(int locStatus); //!< ??? UNUSED_COLUMN(int locStatus); //!< ???
int reward_bankinventory; //!< The amount of bank space this mission rewards 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; CDObjects entry;
entry.id = tableData.getIntField("id", -1); entry.id = tableData.getIntField("id", -1);
entry.name = tableData.getStringField("name", ""); 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", ""); entry.type = tableData.getStringField("type", "");
UNUSED(ntry.description = tableData.getStringField(4, "")); UNUSED_COLUMN(ntry.description = tableData.getStringField(4, ""));
UNUSED(entry.localize = tableData.getIntField("localize", -1)); UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1));
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1)); UNUSED_COLUMN(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
UNUSED(entry.displayName = tableData.getStringField("displayName", "")); UNUSED_COLUMN(entry.displayName = tableData.getStringField("displayName", ""));
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f); entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
UNUSED(entry.nametag = tableData.getIntField("nametag", -1)); UNUSED_COLUMN(entry.nametag = tableData.getIntField("nametag", -1));
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", "")); UNUSED_COLUMN(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1)); UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", "")); UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1)); UNUSED_COLUMN(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
this->entries.insert(std::make_pair(entry.id, entry)); this->entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow(); tableData.nextRow();

View File

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

View File

@ -7,19 +7,19 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
entry->id = tableData.getIntField("id", -1); entry->id = tableData.getIntField("id", -1);
entry->bStatic = tableData.getIntField("static", -1) != 0; entry->bStatic = tableData.getIntField("static", -1) != 0;
entry->physicsAsset = tableData.getStringField("physics_asset", ""); entry->physicsAsset = tableData.getStringField("physics_asset", "");
UNUSED(entry->jump = tableData.getIntField("jump", -1) != 0); UNUSED_COLUMN(entry->jump = tableData.getIntField("jump", -1) != 0);
UNUSED(entry->doublejump = tableData.getIntField("doublejump", -1) != 0); UNUSED_COLUMN(entry->doublejump = tableData.getIntField("doublejump", -1) != 0);
entry->speed = tableData.getFloatField("speed", -1); 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->playerHeight = tableData.getFloatField("playerHeight");
entry->playerRadius = tableData.getFloatField("playerRadius"); entry->playerRadius = tableData.getFloatField("playerRadius");
entry->pcShapeType = tableData.getIntField("pcShapeType"); entry->pcShapeType = tableData.getIntField("pcShapeType");
entry->collisionGroup = tableData.getIntField("collisionGroup"); entry->collisionGroup = tableData.getIntField("collisionGroup");
UNUSED(entry->airSpeed = tableData.getFloatField("airSpeed")); UNUSED_COLUMN(entry->airSpeed = tableData.getFloatField("airSpeed"));
UNUSED(entry->boundaryAsset = tableData.getStringField("boundaryAsset")); UNUSED_COLUMN(entry->boundaryAsset = tableData.getStringField("boundaryAsset"));
UNUSED(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed")); UNUSED_COLUMN(entry->jumpAirSpeed = tableData.getFloatField("jumpAirSpeed"));
UNUSED(entry->friction = tableData.getFloatField("friction")); UNUSED_COLUMN(entry->friction = tableData.getFloatField("friction"));
UNUSED(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset")); UNUSED_COLUMN(entry->gravityVolumeAsset = tableData.getStringField("gravityVolumeAsset"));
m_entries.insert(std::make_pair(entry->id, entry)); m_entries.insert(std::make_pair(entry->id, entry));
tableData.nextRow(); tableData.nextRow();

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
#include "CDClientDatabase.h" #include "CDClientDatabase.h"
#include "Singleton.h" #include "Singleton.h"
#include "DluAssert.h"
#include <functional> #include <functional>
#include <string> #include <string>
@ -15,6 +16,9 @@
#endif #endif
#include "cpplinq.hpp" #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 : 4244) //Disable double to float conversion warnings
#pragma warning (disable : 4715) //Disable "not all control paths return a value" #pragma warning (disable : 4715) //Disable "not all control paths return a value"
@ -23,3 +27,15 @@ class CDTable : public Singleton<Table> {
protected: protected:
virtual ~CDTable() = default; 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;
};

View File

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

View File

@ -12,25 +12,25 @@ struct CDZoneTable {
float ghostdistance; //!< The ghosting distance float ghostdistance; //!< The ghosting distance
unsigned int population_soft_cap; //!< The "soft cap" on the world population unsigned int population_soft_cap; //!< The "soft cap" on the world population
unsigned int population_hard_cap; //!< The "hard 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_COLUMN(std::string DisplayDescription); //!< The display description of the world
UNUSED(std::string mapFolder); //!< ??? UNUSED_COLUMN(std::string mapFolder); //!< ???
float smashableMinDistance; //!< The minimum smashable distance? float smashableMinDistance; //!< The minimum smashable distance?
float smashableMaxDistance; //!< The maximum smashable distance? float smashableMaxDistance; //!< The maximum smashable distance?
UNUSED(std::string mixerProgram); //!< ??? UNUSED_COLUMN(std::string mixerProgram); //!< ???
UNUSED(std::string clientPhysicsFramerate); //!< The client physics framerate UNUSED_COLUMN(std::string clientPhysicsFramerate); //!< The client physics framerate
UNUSED(std::string serverPhysicsFramerate); //!< The server physics framerate UNUSED_COLUMN(std::string serverPhysicsFramerate); //!< The server physics framerate
unsigned int zoneControlTemplate; //!< The Zone Control template unsigned int zoneControlTemplate; //!< The Zone Control template
unsigned int widthInChunks; //!< The width of the world in chunks unsigned int widthInChunks; //!< The width of the world in chunks
unsigned int heightInChunks; //!< The height 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 petsAllowed; //!< Whether or not pets are allowed in the world
bool localize; //!< Whether or not the world should be localized bool localize; //!< Whether or not the world should be localized
float fZoneWeight; //!< ??? 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 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; //!< ??? float teamRadius; //!< ???
UNUSED(std::string gate_version); //!< The gate version UNUSED_COLUMN(std::string gate_version); //!< The gate version
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed UNUSED_COLUMN(bool mountsAllowed); //!< Whether or not mounts are allowed
}; };
class CDZoneTableTable : public CDTable<CDZoneTableTable> { class CDZoneTableTable : public CDTable<CDZoneTableTable> {

View File

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

View File

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

View File

@ -22,7 +22,7 @@
#include "Database.h" #include "Database.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "RenderComponent.h"
std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{}; std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{};
std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::currentActivities{}; std::unordered_map<LWOOBJID, LWOOBJID> PetComponent::currentActivities{};
@ -525,7 +525,7 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
} }
GameMessages::SendPlayFXEffect(tamer, -1, u"petceleb", "", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(tamer, -1, u"petceleb", "", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayAnimation(tamer, u"rebuild-celebrate"); RenderComponent::PlayAnimation(tamer, u"rebuild-celebrate");
EntityInfo info{}; EntityInfo info{};
info.lot = cached->second.puzzleModelLot; info.lot = cached->second.puzzleModelLot;

View File

@ -7,6 +7,8 @@
#include "RebuildComponent.h" #include "RebuildComponent.h"
#include "Game.h" #include "Game.h"
#include "dLogger.h" #include "dLogger.h"
#include "RenderComponent.h"
#include "EntityManager.h"
RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) { RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) {
m_ComponentID = componentID; m_ComponentID = componentID;
@ -57,22 +59,9 @@ void RailActivatorComponent::OnUse(Entity* originator) {
std::to_string(m_StartEffect.first)); std::to_string(m_StartEffect.first));
} }
float animationLength = 0.5f;
if (!m_StartAnimation.empty()) { if (!m_StartAnimation.empty()) {
GameMessages::SendPlayAnimation(originator, m_StartAnimation); animationLength = RenderComponent::PlayAnimation(originator, m_StartAnimation);
}
float animationLength;
if (m_StartAnimation == u"whirlwind-rail-up-earth") {
animationLength = 1.5f;
} else if (m_StartAnimation == u"whirlwind-rail-up-lightning") {
animationLength = 0.5f;
} else if (m_StartAnimation == u"whirlwind-rail-up-ice") {
animationLength = 0.5f;
} else if (m_StartAnimation == u"whirlwind-rail-up-fire") {
animationLength = 0.5f;
} else {
animationLength = 0.5f;
} }
const auto originatorID = originator->GetObjectID(); const auto originatorID = originator->GetObjectID();
@ -111,7 +100,7 @@ void RailActivatorComponent::OnRailMovementReady(Entity* originator) const {
} }
if (!m_LoopAnimation.empty()) { if (!m_LoopAnimation.empty()) {
GameMessages::SendPlayAnimation(originator, m_LoopAnimation); RenderComponent::PlayAnimation(originator, m_LoopAnimation);
} }
GameMessages::SendSetRailMovement(originator->GetObjectID(), m_PathDirection, m_Path, m_PathStart, GameMessages::SendSetRailMovement(originator->GetObjectID(), m_PathDirection, m_Path, m_PathStart,
@ -146,7 +135,7 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) {
} }
if (!m_StopAnimation.empty()) { if (!m_StopAnimation.empty()) {
GameMessages::SendPlayAnimation(originator, m_StopAnimation); RenderComponent::PlayAnimation(originator, m_StopAnimation);
} }
// Remove the player after they've signalled they're done railing // Remove the player after they've signalled they're done railing

View File

@ -16,6 +16,7 @@
#include "Preconditions.h" #include "Preconditions.h"
#include "Loot.h" #include "Loot.h"
#include "TeamManager.h" #include "TeamManager.h"
#include "RenderComponent.h"
#include "CppScripts.h" #include "CppScripts.h"
@ -510,7 +511,7 @@ void RebuildComponent::CompleteRebuild(Entity* user) {
character->SetPlayerFlag(flagNumber, true); character->SetPlayerFlag(flagNumber, true);
} }
} }
GameMessages::SendPlayAnimation(user, u"rebuild-celebrate", 1.09f); RenderComponent::PlayAnimation(user, u"rebuild-celebrate", 1.09f);
} }
void RebuildComponent::ResetRebuild(bool failed) { void RebuildComponent::ResetRebuild(bool failed) {
@ -520,7 +521,7 @@ void RebuildComponent::ResetRebuild(bool failed) {
GameMessages::SendEnableRebuild(m_Parent, false, false, failed, eFailReason::REASON_NOT_GIVEN, m_ResetTime, builder->GetObjectID()); GameMessages::SendEnableRebuild(m_Parent, false, false, failed, eFailReason::REASON_NOT_GIVEN, m_ResetTime, builder->GetObjectID());
if (failed) { if (failed) {
GameMessages::SendPlayAnimation(builder, u"rebuild-fail"); RenderComponent::PlayAnimation(builder, u"rebuild-fail");
} }
} }

View File

@ -11,72 +11,34 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "Game.h" #include "Game.h"
#include "dLogger.h" #include "dLogger.h"
#include "CDAnimationsTable.h"
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{}; std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
RenderComponent::RenderComponent(Entity* parent) : Component(parent) { RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component(parent) {
m_Effects = std::vector<Effect*>(); m_Effects = std::vector<Effect*>();
m_LastAnimationName = "";
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
query.bind(1, componentId);
auto result = query.execQuery();
return; if (!result.eof()) {
auto animationGroupIDs = std::string(result.getStringField("animationGroupIDs", ""));
/* if (!animationGroupIDs.empty()) {
auto* table = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>(); auto* animationsTable = CDClientManager::Instance().GetTable<CDAnimationsTable>();
auto groupIdsSplit = GeneralUtils::SplitString(animationGroupIDs, ',');
const auto entry = table->GetByIDAndType(parent->GetLOT(), eReplicaComponentType::RENDER); for (auto& groupId : groupIdsSplit) {
int32_t groupIdInt;
std::stringstream query; if (!GeneralUtils::TryParse(groupId, groupIdInt)) {
Game::logger->Log("RenderComponent", "bad animation group Id %s", groupId.c_str());
query << "SELECT effect1, effect2, effect3, effect4, effect5, effect6 FROM RenderComponent WHERE id = " << std::to_string(entry) << ";"; continue;
}
auto result = CDClientDatabase::ExecuteQuery(query.str()); m_animationGroupIds.push_back(groupIdInt);
animationsTable->CacheAnimationGroup(groupIdInt);
if (result.eof()) }
{
return;
}
for (auto i = 0; i < 6; ++i)
{
if (result.fieldIsNull(i))
{
continue;
}
const auto id = result.getIntField(i);
if (id <= 0)
{
continue;
}
query.clear();
query << "SELECT effectType, effectName FROM BehaviorEffect WHERE effectID = " << std::to_string(id) << ";";
auto effectResult = CDClientDatabase::ExecuteQuery(query.str());
while (!effectResult.eof())
{
const auto type = effectResult.fieldIsNull(0) ? "" : std::string(effectResult.getStringField(0));
const auto name = effectResult.fieldIsNull(1) ? "" : std::string(effectResult.getStringField(1));
auto* effect = new Effect();
effect->name = name;
effect->type = GeneralUtils::ASCIIToUTF16(type);
effect->scale = 1;
effect->effectID = id;
effect->secondary = LWOOBJID_EMPTY;
m_Effects.push_back(effect);
effectResult.nextRow();
} }
} }
result.finalize(); result.finalize();
*/
} }
RenderComponent::~RenderComponent() { RenderComponent::~RenderComponent() {
@ -224,3 +186,47 @@ void RenderComponent::StopEffect(const std::string& name, const bool killImmedia
std::vector<Effect*>& RenderComponent::GetEffects() { std::vector<Effect*>& RenderComponent::GetEffects() {
return m_Effects; return m_Effects;
} }
float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) {
if (!self) return 0.0f;
return RenderComponent::PlayAnimation(self, GeneralUtils::UTF16ToWTF8(animation), priority, scale);
}
float RenderComponent::PlayAnimation(Entity* self, const std::string& animation, float priority, float scale) {
if (!self) return 0.0f;
return RenderComponent::DoAnimation(self, animation, true, priority, scale);
}
float RenderComponent::GetAnimationTime(Entity* self, const std::u16string& animation) {
if (!self) return 0.0f;
return RenderComponent::GetAnimationTime(self, GeneralUtils::UTF16ToWTF8(animation));
}
float RenderComponent::GetAnimationTime(Entity* self, const std::string& animation) {
if (!self) return 0.0f;
return RenderComponent::DoAnimation(self, animation, false);
}
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
if (!self) return 0.0f;
auto* renderComponent = self->GetComponent<RenderComponent>();
if (!renderComponent) return 0.0f;
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;
}
}
Game::logger->Log("RenderComponent", "unable to find animation %s for lot %i", animation.c_str(), self->GetLOT());
return 0.0f;
}

View File

@ -58,7 +58,7 @@ class RenderComponent : public Component {
public: public:
static const eReplicaComponentType ComponentType = eReplicaComponentType::RENDER; static const eReplicaComponentType ComponentType = eReplicaComponentType::RENDER;
RenderComponent(Entity* entity); RenderComponent(Entity* entity, int32_t componentId = -1);
~RenderComponent() override; ~RenderComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags); void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
@ -104,6 +104,16 @@ public:
*/ */
std::vector<Effect*>& GetEffects(); std::vector<Effect*>& GetEffects();
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);
static float PlayAnimation(Entity* self, const std::string& animation, float priority = 0.0f, float scale = 1.0f);
static float GetAnimationTime(Entity* self, const std::string& animation);
static float GetAnimationTime(Entity* self, const std::u16string& animation);
const std::string& GetLastAnimationName() const { return m_LastAnimationName; };
void SetLastAnimationName(const std::string& name) { m_LastAnimationName = name; };
private: private:
/** /**
@ -111,6 +121,11 @@ private:
*/ */
std::vector<Effect*> m_Effects; std::vector<Effect*> m_Effects;
std::vector<int32_t> m_animationGroupIds;
// The last animationName that was played
std::string m_LastAnimationName;
/** /**
* Cache of queries that look for the length of each effect, indexed by effect ID * Cache of queries that look for the length of each effect, indexed by effect ID
*/ */

View File

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

View File

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

View File

@ -1,6 +1,7 @@
#include "SwitchComponent.h" #include "SwitchComponent.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "eTriggerEventType.h" #include "eTriggerEventType.h"
#include "RenderComponent.h"
std::vector<SwitchComponent*> SwitchComponent::petSwitches; std::vector<SwitchComponent*> SwitchComponent::petSwitches;
@ -59,7 +60,7 @@ void SwitchComponent::EntityEnter(Entity* entity) {
if (m_PetBouncer != nullptr) { if (m_PetBouncer != nullptr) {
GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 2602, u"pettriggeractive", "BounceEffect", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(m_Parent->GetObjectID(), 2602, u"pettriggeractive", "BounceEffect", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayAnimation(m_Parent, u"engaged", 0, 1); RenderComponent::PlayAnimation(m_Parent, u"engaged");
m_PetBouncer->SetPetBouncerEnabled(true); m_PetBouncer->SetPetBouncerEnabled(true);
} else { } else {
EntityManager::Instance()->SerializeEntity(m_Parent); EntityManager::Instance()->SerializeEntity(m_Parent);

View File

@ -34,6 +34,7 @@
#include "eRacingTaskParam.h" #include "eRacingTaskParam.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "RenderComponent.h"
#include <sstream> #include <sstream>
#include <future> #include <future>
@ -5110,7 +5111,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
if (emote) sAnimationName = emote->animationName; if (emote) sAnimationName = emote->animationName;
} }
GameMessages::SendPlayAnimation(entity, GeneralUtils::ASCIIToUTF16(sAnimationName)); RenderComponent::PlayAnimation(entity, sAnimationName);
} }
void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { void GameMessages::HandleModularBuildConvertModel(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) {

View File

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

View File

@ -76,6 +76,7 @@
#include "TriggerComponent.h" #include "TriggerComponent.h"
#include "eServerDisconnectIdentifiers.h" #include "eServerDisconnectIdentifiers.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "CDObjectsTable.h" #include "CDObjectsTable.h"
#include "CDZoneTableTable.h" #include "CDZoneTableTable.h"
@ -418,11 +419,11 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) { if ((chatCommand == "playanimation" || chatCommand == "playanim") && args.size() == 1 && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER) {
std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size()); std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size());
GameMessages::SendPlayAnimation(entity, anim); RenderComponent::PlayAnimation(entity, anim);
auto* possessorComponent = entity->GetComponent<PossessorComponent>(); auto* possessorComponent = entity->GetComponent<PossessorComponent>();
if (possessorComponent) { if (possessorComponent) {
auto* possessedComponent = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable()); auto* possessedComponent = EntityManager::Instance()->GetEntity(possessorComponent->GetPossessable());
if (possessedComponent) GameMessages::SendPlayAnimation(possessedComponent, anim); if (possessedComponent) RenderComponent::PlayAnimation(possessedComponent, anim);
} }
} }
@ -1955,7 +1956,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
EntityManager::Instance()->SerializeEntity(closest); EntityManager::Instance()->SerializeEntity(closest);
} else if (args[1] == "-a" && args.size() >= 3) { } else if (args[1] == "-a" && args.size() >= 3) {
GameMessages::SendPlayAnimation(closest, GeneralUtils::UTF8ToUTF16(args[2])); RenderComponent::PlayAnimation(closest, args.at(2));
} else if (args[1] == "-s") { } else if (args[1] == "-s") {
for (auto* entry : closest->GetSettings()) { for (auto* entry : closest->GetSettings()) {
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::UTF8ToUTF16(entry->GetString())); ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::UTF8ToUTF16(entry->GetString()));

View File

@ -49,6 +49,7 @@ namespace Game {
dConfig* config = nullptr; dConfig* config = nullptr;
AssetManager* assetManager = nullptr; AssetManager* assetManager = nullptr;
bool shouldShutdown = false; bool shouldShutdown = false;
std::mt19937 randomEngine;
} //namespace Game } //namespace Game
bool shutdownSequenceStarted = false; bool shutdownSequenceStarted = false;
@ -290,6 +291,7 @@ int main(int argc, char** argv) {
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
Game::randomEngine = std::mt19937(time(0));
uint32_t maxClients = 999; uint32_t maxClients = 999;
uint32_t ourPort = 1000; uint32_t ourPort = 1000;
if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients")); if (Game::config->GetValue("max_clients") != "") maxClients = std::stoi(Game::config->GetValue("max_clients"));
@ -332,8 +334,7 @@ int main(int argc, char** argv) {
if (Game::config->GetValue("prestart_servers") != "" && Game::config->GetValue("prestart_servers") == "1") { if (Game::config->GetValue("prestart_servers") != "" && Game::config->GetValue("prestart_servers") == "1") {
StartChatServer(); StartChatServer();
Game::im->GetInstance(0, false, 0); Game::im->GetInstance(1800, false, 0);
Game::im->GetInstance(1000, false, 0);
StartAuthServer(); StartAuthServer();
} }

View File

@ -2,6 +2,7 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "dServer.h" #include "dServer.h"
#include "VanityUtilities.h" #include "VanityUtilities.h"
#include "RenderComponent.h"
void DLUVanityNPC::OnStartup(Entity* self) { void DLUVanityNPC::OnStartup(Entity* self) {
m_NPC = VanityUtilities::GetNPC("averysumner - Destroyer of Worlds"); m_NPC = VanityUtilities::GetNPC("averysumner - Destroyer of Worlds");
@ -17,7 +18,7 @@ void DLUVanityNPC::OnStartup(Entity* self) {
void DLUVanityNPC::OnTimerDone(Entity* self, std::string timerName) { void DLUVanityNPC::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "setupTeleport") { if (timerName == "setupTeleport") {
GameMessages::SendPlayAnimation(self, u"interact"); RenderComponent::PlayAnimation(self, u"interact");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam"); GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportBeam", "teleportBeam");
GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings"); GameMessages::SendPlayFXEffect(self->GetObjectID(), 6478, u"teleportRings", "teleportRings");

View File

@ -14,6 +14,7 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include <vector> #include <vector>
@ -695,11 +696,11 @@ float BossSpiderQueenEnemyServer::PlayAnimAndReturnTime(Entity* self, const std:
//TODO: Get the actual animation time //TODO: Get the actual animation time
// Get the anim time // Get the anim time
float animTimer = defaultAnimPause; //self:GetAnimationTime{animationID = animID}.time float animTimer = RenderComponent::GetAnimationTime(self, animID);
// If we have an animation play it // If we have an animation play it
if (animTimer > 0) { if (animTimer > 0) {
GameMessages::SendPlayAnimation(self, animID); animTimer = RenderComponent::PlayAnimation(self, animID);
} }
// If the anim time is less than the the default time use default // If the anim time is less than the the default time use default

View File

@ -7,6 +7,7 @@
#include "BaseCombatAIComponent.h" #include "BaseCombatAIComponent.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "eAninmationFlags.h" #include "eAninmationFlags.h"
#include "RenderComponent.h"
void AmDarklingDragon::OnStartup(Entity* self) { void AmDarklingDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0); self->SetVar<int32_t>(u"weakspot", 0);
@ -70,9 +71,9 @@ void AmDarklingDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_t
self->SetVar<int32_t>(u"weakpoint", 2); self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f); float animationTime = RenderComponent::PlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1); self->AddTimer("timeToStunLoop", animationTime);
auto position = self->GetPosition(); auto position = self->GetPosition();
auto forward = self->GetRotation().GetForwardVector(); auto forward = self->GetRotation().GetForwardVector();
@ -121,9 +122,9 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") { } else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1); self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") { } else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f); RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") { } else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f); RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1); self->AddTimer("backToAttack", 1);
} else if (timerName == "backToAttack") { } else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>(); auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
@ -153,5 +154,5 @@ void AmDarklingDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID()); self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f); RenderComponent::PlayAnimation(self, u"quickbuildhold", 1.9f);
} }

View File

@ -5,6 +5,7 @@
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "eAninmationFlags.h" #include "eAninmationFlags.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "RenderComponent.h"
void FvMaelstromDragon::OnStartup(Entity* self) { void FvMaelstromDragon::OnStartup(Entity* self) {
self->SetVar<int32_t>(u"weakspot", 0); self->SetVar<int32_t>(u"weakspot", 0);
@ -86,9 +87,9 @@ void FvMaelstromDragon::OnHitOrHealResult(Entity* self, Entity* attacker, int32_
self->SetVar<int32_t>(u"weakpoint", 2); self->SetVar<int32_t>(u"weakpoint", 2);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayAnimation(self, u"stunstart", 1.7f); RenderComponent::PlayAnimation(self, u"stunstart", 1.7f);
self->AddTimer("timeToStunLoop", 1); self->AddTimer("timeToStunLoop", 1.0f);
auto position = self->GetPosition(); auto position = self->GetPosition();
auto forward = self->GetRotation().GetForwardVector(); auto forward = self->GetRotation().GetForwardVector();
@ -137,10 +138,10 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") { } else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1); self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") { } else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f); RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") { } else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f); RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1); self->AddTimer("backToAttack", 1.0f);
} else if (timerName == "backToAttack") { } else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>(); auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>(); auto* skillComponent = self->GetComponent<SkillComponent>();
@ -174,5 +175,5 @@ FvMaelstromDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID()); self->SetVar<LWOOBJID>(u"Golem", sender->GetObjectID());
GameMessages::SendPlayAnimation(self, u"quickbuildhold", 1.9f); RenderComponent::PlayAnimation(self, u"quickbuildhold", 1.9f);
} }

View File

@ -6,6 +6,7 @@
#include "EntityInfo.h" #include "EntityInfo.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "eAninmationFlags.h" #include "eAninmationFlags.h"
#include "RenderComponent.h"
void BaseEnemyApe::OnStartup(Entity* self) { void BaseEnemyApe::OnStartup(Entity* self) {
self->SetVar<uint32_t>(u"timesStunned", 2); self->SetVar<uint32_t>(u"timesStunned", 2);
@ -37,7 +38,7 @@ void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
if (skillComponent) { if (skillComponent) {
skillComponent->Reset(); skillComponent->Reset();
} }
GameMessages::SendPlayAnimation(self, u"disable", 1.7f); RenderComponent::PlayAnimation(self, u"disable", 1.7f);
GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendChangeIdleFlags(self->GetObjectID(), eAnimationFlags::IDLE_NONE, eAnimationFlags::IDLE_COMBAT, UNASSIGNED_SYSTEM_ADDRESS);
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
? self->GetVar<float_t>(u"reviveTime") : 12.0f; ? self->GetVar<float_t>(u"reviveTime") : 12.0f;

View File

@ -1,6 +1,8 @@
#include "GfApeSmashingQB.h" #include "GfApeSmashingQB.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void GfApeSmashingQB::OnStartup(Entity* self) { void GfApeSmashingQB::OnStartup(Entity* self) {
self->SetNetworkVar<LWOOBJID>(u"lootTagOwner", self->GetVar<LWOOBJID>(u"lootTagOwner")); self->SetNetworkVar<LWOOBJID>(u"lootTagOwner", self->GetVar<LWOOBJID>(u"lootTagOwner"));
@ -16,7 +18,7 @@ void GfApeSmashingQB::OnRebuildComplete(Entity* self, Entity* target) {
auto* ape = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ape")); auto* ape = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"ape"));
if (ape != nullptr) { if (ape != nullptr) {
ape->OnFireEventServerSide(target, "rebuildDone"); ape->OnFireEventServerSide(target, "rebuildDone");
GameMessages::SendPlayAnimation(self, u"smash", 1.7f); RenderComponent::PlayAnimation(self, u"smash", 1.7f);
self->AddTimer("anchorBreakTime", 1.0f); self->AddTimer("anchorBreakTime", 1.0f);
} }
} }

View File

@ -4,19 +4,15 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "RenderComponent.h"
void MaestromExtracticatorServer::OnStartup(Entity* self) { void MaestromExtracticatorServer::OnStartup(Entity* self) {
//self:SetNetworkVar("current_anim", failAnim) self->AddTimer("PlayFail", RenderComponent::PlayAnimation(self, failAnim));
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
self->AddTimer("PlayFail", defaultTime);
self->AddTimer("RemoveSample", destroyAfterNoSampleTime); self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
} }
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
int32_t param2, int32_t param3) { if (sender == nullptr) return;
if (sender == nullptr)
return;
if (args == "attemptCollection") { if (args == "attemptCollection") {
Entity* player = EntityManager::Instance()->GetEntity(self->GetSpawnerID()); Entity* player = EntityManager::Instance()->GetEntity(self->GetSpawnerID());
@ -32,20 +28,17 @@ void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* se
} }
void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) { void MaestromExtracticatorServer::CollectSample(Entity* self, LWOOBJID sampleObj) {
PlayAnimAndReturnTime(self, collectAnim); self->AddTimer("RemoveSample", PlayAnimAndReturnTime(self, collectAnim));
self->AddTimer("RemoveSample", defaultTime);
} }
void MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) { float MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animID)); return RenderComponent::PlayAnimation(self, animID);
} }
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) { void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "RemoveSample") { if (timerName == "RemoveSample") {
self->ScheduleKillAfterUpdate(); self->ScheduleKillAfterUpdate();
} } else if (timerName == "PlayFail") {
RenderComponent::PlayAnimation(self, failAnim);
if (timerName == "PlayFail") {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
} }
} }

View File

@ -7,12 +7,11 @@ public:
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3); int32_t param3);
void CollectSample(Entity* self, LWOOBJID sampleObj); void CollectSample(Entity* self, LWOOBJID sampleObj);
void PlayAnimAndReturnTime(Entity* self, std::string animID); float PlayAnimAndReturnTime(Entity* self, std::string animID);
void OnTimerDone(Entity* self, std::string timerName); void OnTimerDone(Entity* self, std::string timerName);
private: private:
const std::string failAnim = "idle_maelstrom"; const std::string failAnim = "idle_maelstrom";
const std::string collectAnim = "collect_maelstrom"; const std::string collectAnim = "collect_maelstrom";
const float defaultTime = 4.0f;
const float destroyAfterNoSampleTime = 8.0f; const float destroyAfterNoSampleTime = 8.0f;
}; };

View File

@ -1,5 +1,8 @@
#include "AgMonumentBirds.h" #include "AgMonumentBirds.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
#include "EntityManager.h"
//-------------------------------------------------------------- //--------------------------------------------------------------
//Makes the ag birds fly away when you get close and smashes them. //Makes the ag birds fly away when you get close and smashes them.
@ -16,7 +19,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
if (name == "MonumentBirds" && status == "ENTER") { if (name == "MonumentBirds" && status == "ENTER") {
self->AddTimer("killBird", 1.0f); self->AddTimer("killBird", 1.0f);
GameMessages::SendPlayAnimation(self, sOnProximityAnim); RenderComponent::PlayAnimation(self, sOnProximityAnim);
self->SetVar<bool>(u"IsFlying", true); self->SetVar<bool>(u"IsFlying", true);
self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID()); self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID());
} }

View File

@ -5,6 +5,7 @@
#include "ProximityMonitorComponent.h" #include "ProximityMonitorComponent.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "RenderComponent.h"
void AmSkullkinDrill::OnStartup(Entity* self) { void AmSkullkinDrill::OnStartup(Entity* self) {
self->SetNetworkVar(u"bIsInUse", false); self->SetNetworkVar(u"bIsInUse", false);
@ -70,7 +71,7 @@ void AmSkullkinDrill::OnSkillEventFired(Entity* self, Entity* caster, const std:
} }
void AmSkullkinDrill::TriggerDrill(Entity* self) { void AmSkullkinDrill::TriggerDrill(Entity* self) {
GameMessages::SendPlayAnimation(self, u"slowdown"); RenderComponent::PlayAnimation(self, u"slowdown");
self->AddTimer("killDrill", 10.0f); self->AddTimer("killDrill", 10.0f);
@ -170,7 +171,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
auto* standObj = GetStandObj(self); auto* standObj = GetStandObj(self);
if (waypointIndex == 1) { if (waypointIndex == 1) {
GameMessages::SendPlayAnimation(self, u"no-spin"); RenderComponent::PlayAnimation(self, u"no-spin");
GameMessages::SendStopFXEffect(self, true, "active"); GameMessages::SendStopFXEffect(self, true, "active");
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator"); GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"indicator", "indicator");
@ -190,7 +191,7 @@ void AmSkullkinDrill::OnArrived(Entity* self, uint32_t waypointIndex) {
return; return;
} else { } else {
GameMessages::SendPlayAnimation(self, u"idle"); RenderComponent::PlayAnimation(self, u"idle");
GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active"); GameMessages::SendPlayFXEffect(self->GetObjectID(), -1, u"spin", "active");
GameMessages::SendStopFXEffect(self, true, "indicator"); GameMessages::SendStopFXEffect(self, true, "indicator");
} }
@ -215,7 +216,7 @@ void AmSkullkinDrill::PlayCinematic(Entity* self) {
void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& animName) { void AmSkullkinDrill::PlayAnim(Entity* self, Entity* player, const std::string& animName) {
const auto animTime = animName == "spinjitzu-staff-end" ? 0.5f : 1.0f; const auto animTime = animName == "spinjitzu-staff-end" ? 0.5f : 1.0f;
GameMessages::SendPlayAnimation(player, GeneralUtils::ASCIIToUTF16(animName)); RenderComponent::PlayAnimation(player, animName);
self->AddTimer("AnimDone_" + animName, animTime); self->AddTimer("AnimDone_" + animName, animTime);
} }
@ -308,7 +309,7 @@ void AmSkullkinDrill::OnTimerDone(Entity* self, std::string timerName) {
if (animName == "spinjitzu-staff-windup") { if (animName == "spinjitzu-staff-windup") {
TriggerDrill(self); TriggerDrill(self);
GameMessages::SendPlayAnimation(player, u"spinjitzu-staff-loop"); RenderComponent::PlayAnimation(player, u"spinjitzu-staff-loop");
} else if (animName == "spinjitzu-staff-end") { } else if (animName == "spinjitzu-staff-end") {
FreezePlayer(self, player, false); FreezePlayer(self, player, false);

View File

@ -1,6 +1,8 @@
#include "AmSkullkinDrillStand.h" #include "AmSkullkinDrillStand.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "dpEntity.h" #include "dpEntity.h"
#include "Entity.h"
#include "RenderComponent.h"
void AmSkullkinDrillStand::OnStartup(Entity* self) { void AmSkullkinDrillStand::OnStartup(Entity* self) {
self->SetVar(u"bActive", true); self->SetVar(u"bActive", true);
@ -31,5 +33,5 @@ void AmSkullkinDrillStand::OnProximityUpdate(Entity* self, Entity* entering, std
GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack"); GameMessages::SendPlayFXEffect(entering->GetObjectID(), 1378, u"create", "pushBack");
GameMessages::SendPlayAnimation(entering, u"knockback-recovery"); RenderComponent::PlayAnimation(entering, u"knockback-recovery");
} }

View File

@ -5,6 +5,7 @@
#include "EntityInfo.h" #include "EntityInfo.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "RenderComponent.h"
void AmSkullkinTower::OnStartup(Entity* self) { void AmSkullkinTower::OnStartup(Entity* self) {
self->SetProximityRadius(20, "Tower"); self->SetProximityRadius(20, "Tower");
@ -117,13 +118,13 @@ void AmSkullkinTower::OnChildRemoved(Entity* self, Entity* child) {
self->SetVar(u"legTable", legTable); self->SetVar(u"legTable", legTable);
if (legTable.size() == 2) { if (legTable.size() == 2) {
GameMessages::SendPlayAnimation(self, u"wobble-1"); RenderComponent::PlayAnimation(self, u"wobble-1");
} else if (legTable.size() == 1) { } else if (legTable.size() == 1) {
GameMessages::SendPlayAnimation(self, u"wobble-2"); RenderComponent::PlayAnimation(self, u"wobble-2");
} else if (legTable.empty()) { } else if (legTable.empty()) {
const auto animTime = 2.5f; const auto animTime = 2.5f;
GameMessages::SendPlayAnimation(self, u"fall"); RenderComponent::PlayAnimation(self, u"fall");
self->AddTimer("spawnGuys", animTime - 0.2f); self->AddTimer("spawnGuys", animTime - 0.2f);

View File

@ -2,6 +2,7 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "RenderComponent.h"
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) { void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
if (self->GetVar<bool>(u"bIsInUse")) { if (self->GetVar<bool>(u"bIsInUse")) {
@ -27,7 +28,7 @@ void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress()); GameMessages::SendTeleport(user->GetObjectID(), position, rotation, user->GetSystemAddress());
GameMessages::SendPlayAnimation(user, u"cannon-strike-no-equip"); RenderComponent::PlayAnimation(user, u"cannon-strike-no-equip");
GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(user->GetObjectID(), 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
@ -58,7 +59,7 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
for (auto* shark : sharkObjects) { for (auto* shark : sharkObjects) {
if (shark->GetLOT() != m_SharkItemID) continue; if (shark->GetLOT() != m_SharkItemID) continue;
GameMessages::SendPlayAnimation(shark, u"cannon"); RenderComponent::PlayAnimation(shark, u"cannon");
} }
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}"); GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");

View File

@ -5,6 +5,7 @@
#include "RenderComponent.h" #include "RenderComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
void GfTikiTorch::OnStartup(Entity* self) { void GfTikiTorch::OnStartup(Entity* self) {
LightTorch(self); LightTorch(self);
@ -16,7 +17,7 @@ void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
return; return;
} }
GameMessages::SendPlayAnimation(self, u"interact"); RenderComponent::PlayAnimation(self, u"interact");
self->SetI64(u"userID", killer->GetObjectID()); self->SetI64(u"userID", killer->GetObjectID());
for (int i = 0; i < m_numspawn; i++) { for (int i = 0; i < m_numspawn; i++) {
@ -55,7 +56,7 @@ void GfTikiTorch::LightTorch(Entity* self) {
void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) { void GfTikiTorch::OnSkillEventFired(Entity* self, Entity* caster, const std::string& message) {
if (self->GetBoolean(u"isBurning") && message == "waterspray") { if (self->GetBoolean(u"isBurning") && message == "waterspray") {
GameMessages::SendPlayAnimation(self, u"water"); RenderComponent::PlayAnimation(self, u"water");
auto* renderComponent = self->GetComponent<RenderComponent>(); auto* renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr) { if (renderComponent != nullptr) {

View File

@ -8,6 +8,7 @@
#define _USE_MATH_DEFINES #define _USE_MATH_DEFINES
#include <math.h> #include <math.h>
#endif #endif
#include "RenderComponent.h"
void MastTeleport::OnStartup(Entity* self) { void MastTeleport::OnStartup(Entity* self) {
self->SetNetworkVar<std::string>(u"hookPreconditions", "154;44", UNASSIGNED_SYSTEM_ADDRESS); self->SetNetworkVar<std::string>(u"hookPreconditions", "154;44", UNASSIGNED_SYSTEM_ADDRESS);
@ -58,11 +59,12 @@ void MastTeleport::OnTimerDone(Entity* self, std::string timerName) {
GameMessages::SendPlayFXEffect(playerId, 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(playerId, 6039, u"hook", "hook", LWOOBJID_EMPTY, 1, 1, true);
GameMessages::SendPlayAnimation(player, u"crow-swing-no-equip", 4.0f); float animationTime = 6.25f;
animationTime = RenderComponent::PlayAnimation(player, "crow-swing-no-equip", 4.0f);
GameMessages::SendPlayAnimation(self, u"swing"); RenderComponent::PlayAnimation(self, u"swing");
self->AddTimer("PlayerAnimDone", 6.25f); self->AddTimer("PlayerAnimDone", animationTime);
} else if (timerName == "PlayerAnimDone") { } else if (timerName == "PlayerAnimDone") {
GameMessages::SendStopFXEffect(player, true, "hook"); GameMessages::SendStopFXEffect(player, true, "hook");

View File

@ -4,6 +4,7 @@
#include "MissionComponent.h" #include "MissionComponent.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "RenderComponent.h"
//TODO: this has to be updated so that you only get killed if you're in a certain radius. //TODO: this has to be updated so that you only get killed if you're in a certain radius.
//And so that all entities in a certain radius are killed, not just the attacker. //And so that all entities in a certain radius are killed, not just the attacker.
@ -69,23 +70,6 @@ void ExplodingAsset::OnHit(Entity* self, Entity* attacker) {
} }
void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) { void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::string name, std::string status) {
/*
if msg.objId:BelongsToFaction{factionID = 1}.bIsInFaction then
if (msg.status == "ENTER") then
self:PlayAnimation{ animationID = "bounce" }
self:PlayFXEffect{ name = "bouncin", effectType = "anim" }
self:SetVar("playersNearChest", (self:GetVar("playersNearChest") + 1 ))
elseif (msg.status == "LEAVE") then
self:SetVar("playersNearChest", (self:GetVar("playersNearChest") - 1 ))
if self:GetVar("playersNearChest") < 1 then
self:PlayAnimation{ animationID = "idle" }
self:StopFXEffect{ name = "bouncin" }
self:SetVar("playersNearChest", 0)
end
end
end
*/
auto* destuctableComponent = entering->GetComponent<DestroyableComponent>(); auto* destuctableComponent = entering->GetComponent<DestroyableComponent>();
if (destuctableComponent == nullptr) return; if (destuctableComponent == nullptr) return;
@ -95,14 +79,14 @@ void ExplodingAsset::OnProximityUpdate(Entity* self, Entity* entering, std::stri
if (!std::count(factions.begin(), factions.end(), 1)) return; if (!std::count(factions.begin(), factions.end(), 1)) return;
if (status == "ENTER") { if (status == "ENTER") {
GameMessages::SendPlayAnimation(self, u"bounce"); RenderComponent::PlayAnimation(self, u"bounce");
GameMessages::SendPlayFXEffect(self, -1, u"anim", "bouncin", LWOOBJID_EMPTY, 1, 1, true); GameMessages::SendPlayFXEffect(self, -1, u"anim", "bouncin", LWOOBJID_EMPTY, 1, 1, true);
self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") + 1); self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") + 1);
} else if (status == "LEAVE") { } else if (status == "LEAVE") {
self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") - 1); self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") - 1);
if (self->GetVar<int32_t>(u"playersNearChest") < 1) { if (self->GetVar<int32_t>(u"playersNearChest") < 1) {
GameMessages::SendPlayAnimation(self, u"idle"); RenderComponent::PlayAnimation(self, u"idle");
GameMessages::SendStopFXEffect(self, true, "bouncin"); GameMessages::SendStopFXEffect(self, true, "bouncin");
self->SetVar<int32_t>(u"playersNearChest", 0); self->SetVar<int32_t>(u"playersNearChest", 0);
} }

View File

@ -1,6 +1,8 @@
#include "NjIceRailActivator.h" #include "NjIceRailActivator.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const std::u16string& pathName, void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const std::u16string& pathName,
int32_t waypoint) { int32_t waypoint) {
@ -9,7 +11,7 @@ void NjIceRailActivator::OnPlayerRailArrived(Entity* self, Entity* sender, const
const auto& blockGroup = self->GetVar<std::u16string>(BlockGroupVariable); const auto& blockGroup = self->GetVar<std::u16string>(BlockGroupVariable);
for (auto* block : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) { for (auto* block : EntityManager::Instance()->GetEntitiesInGroup(GeneralUtils::UTF16ToWTF8(blockGroup))) {
GameMessages::SendPlayAnimation(block, u"explode"); RenderComponent::PlayAnimation(block, u"explode");
const auto blockID = block->GetObjectID(); const auto blockID = block->GetObjectID();

View File

@ -4,6 +4,7 @@
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "RenderComponent.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) { void NtAssemblyTubeServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport"); self->SetProximityRadius(5, "teleport");
@ -49,7 +50,7 @@ void NtAssemblyTubeServer::RunAssemblyTube(Entity* self, Entity* player) {
); );
} }
GameMessages::SendPlayAnimation(player, u"tube-sucker", 4.0f); RenderComponent::PlayAnimation(player, u"tube-sucker", 4.0f);
const auto animTime = 3; const auto animTime = 3;
@ -82,7 +83,7 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true); GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"tube-resurrect", 4.0f); RenderComponent::PlayAnimation(player, u"tube-resurrect", 4.0f);
const auto animTime = 2; const auto animTime = 2;

View File

@ -4,6 +4,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "Character.h" #include "Character.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "RenderComponent.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) { void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"bActive", 1, 0, user->GetObjectID(), "", user->GetSystemAddress());
@ -32,18 +33,18 @@ void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
player->GetCharacter()->SetPlayerFlag(flag, true); player->GetCharacter()->SetPlayerFlag(flag, true);
GameMessages::SendPlayAnimation(player, u"rebuild-celebrate"); RenderComponent::PlayAnimation(player, u"rebuild-celebrate");
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SparkStop", 0, 0, player->GetObjectID(), "", player->GetSystemAddress()); GameMessages::SendNotifyClientObject(self->GetObjectID(), u"SparkStop", 0, 0, player->GetObjectID(), "", player->GetSystemAddress());
GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true); GameMessages::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
self->SetVar(u"bActive", false); self->SetVar(u"bActive", false);
}); });
GameMessages::SendPlayAnimation(user, u"nexus-powerpanel", 6.0f); RenderComponent::PlayAnimation(user, u"nexus-powerpanel", 6.0f);
GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true); GameMessages::SendSetStunned(user->GetObjectID(), eStateChangeType::PUSH, user->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
return; return;
} }
GameMessages::SendPlayAnimation(user, shockAnim); RenderComponent::PlayAnimation(user, shockAnim);
const auto dir = self->GetRotation().GetRightVector(); const auto dir = self->GetRotation().GetRightVector();

View File

@ -3,6 +3,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "RenderComponent.h"
void NtParadoxTeleServer::OnStartup(Entity* self) { void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport"); self->SetProximityRadius(5, "teleport");
@ -27,7 +28,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
true, true, true, true, true, true, true true, true, true, true, true, true, true
); );
GameMessages::SendPlayAnimation(player, u"teledeath", 4.0f); RenderComponent::PlayAnimation(player, u"teledeath", 4.0f);
const auto animTime = 2; const auto animTime = 2;
@ -73,7 +74,7 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true); GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"paradox-teleport-in", 4.0f); RenderComponent::PlayAnimation(player, u"paradox-teleport-in", 4.0f);
const auto animTime = 2; const auto animTime = 2;

View File

@ -1,6 +1,7 @@
#include "NtSleepingGuard.h" #include "NtSleepingGuard.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "RenderComponent.h"
void NtSleepingGuard::OnStartup(Entity* self) { void NtSleepingGuard::OnStartup(Entity* self) {
self->SetNetworkVar<bool>(u"asleep", true); self->SetNetworkVar<bool>(u"asleep", true);
@ -17,7 +18,7 @@ void NtSleepingGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity*
// Set asleep to false // Set asleep to false
self->SetNetworkVar<bool>(u"asleep", false); self->SetNetworkVar<bool>(u"asleep", false);
GameMessages::SendPlayAnimation(self, u"greet"); RenderComponent::PlayAnimation(self, u"greet");
auto* missionComponent = target->GetComponent<MissionComponent>(); auto* missionComponent = target->GetComponent<MissionComponent>();

View File

@ -1,6 +1,9 @@
#include "NtVentureCannonServer.h" #include "NtVentureCannonServer.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "Entity.h"
#include "GeneralUtils.h"
#include "RenderComponent.h"
void NtVentureCannonServer::OnUse(Entity* self, Entity* user) { void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
auto* player = user; auto* player = user;
@ -26,7 +29,7 @@ void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendTeleport(playerID, destPosition, destRotation, player->GetSystemAddress(), true); GameMessages::SendTeleport(playerID, destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"scale-down", 4.0f); RenderComponent::PlayAnimation(player, u"scale-down", 4.0f);
const auto enterCinematicUname = enterCinematic; const auto enterCinematicUname = enterCinematic;
GameMessages::SendPlayCinematic(player->GetObjectID(), enterCinematicUname, player->GetSystemAddress()); GameMessages::SendPlayCinematic(player->GetObjectID(), enterCinematicUname, player->GetSystemAddress());
@ -118,5 +121,5 @@ void NtVentureCannonServer::FirePlayer(Entity* self, Entity* player) {
GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true); GameMessages::SendTeleport(player->GetObjectID(), destPosition, destRotation, player->GetSystemAddress(), true);
GameMessages::SendPlayAnimation(player, u"venture-cannon-out", 4.0f); RenderComponent::PlayAnimation(player, u"venture-cannon-out", 4.0f);
} }

View File

@ -1,6 +1,8 @@
#include "CatapultBaseServer.h" #include "CatapultBaseServer.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "Entity.h"
#include "RenderComponent.h"
void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) { void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std::string& name, int32_t param1, int32_t param2) {
if (name == "BouncerBuilt") { if (name == "BouncerBuilt") {
@ -21,7 +23,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
// tell the arm to the play the platform animation, which is just the arm laying there but with bouncer // tell the arm to the play the platform animation, which is just the arm laying there but with bouncer
for (auto* obj : arm) { for (auto* obj : arm) {
GameMessages::SendPlayAnimation(obj, u"idle-platform"); RenderComponent::PlayAnimation(obj, u"idle-platform");
GameMessages::SendPlayNDAudioEmitter(obj, UNASSIGNED_SYSTEM_ADDRESS, "{8cccf912-69e3-4041-a20b-63e4afafc993}"); GameMessages::SendPlayNDAudioEmitter(obj, UNASSIGNED_SYSTEM_ADDRESS, "{8cccf912-69e3-4041-a20b-63e4afafc993}");
// set the art so we can use it again // set the art so we can use it again
self->SetVar(u"Arm", obj->GetObjectID()); self->SetVar(u"Arm", obj->GetObjectID());
@ -38,7 +40,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
// tell the arm to player the launcher animation // tell the arm to player the launcher animation
auto animTime = 1; auto animTime = 1;
self->AddTimer("resetArm", animTime); self->AddTimer("resetArm", animTime);
GameMessages::SendPlayAnimation(arm, u"launch"); RenderComponent::PlayAnimation(arm, u"launch");
} else if (timerName == "bounce") { } else if (timerName == "bounce") {
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer")); auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
if (bouncer == nullptr) return; if (bouncer == nullptr) return;
@ -52,7 +54,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
if (arm == nullptr) return; if (arm == nullptr) return;
// set the arm back to natural state // set the arm back to natural state
GameMessages::SendPlayAnimation(arm, u"idle"); RenderComponent::PlayAnimation(arm, u"idle");
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer")); auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
if (bouncer == nullptr) return; if (bouncer == nullptr) return;

View File

@ -4,6 +4,7 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "Character.h" #include "Character.h"
#include "dZoneManager.h" #include "dZoneManager.h"
#include "RenderComponent.h"
void CavePrisonCage::OnStartup(Entity* self) { void CavePrisonCage::OnStartup(Entity* self) {
const auto& myNum = self->GetVar<std::u16string>(u"myNumber"); const auto& myNum = self->GetVar<std::u16string>(u"myNumber");
@ -101,7 +102,7 @@ void CavePrisonCage::SpawnCounterweight(Entity* self, Spawner* spawner) {
} }
// Play the 'down' animation on the button // Play the 'down' animation on the button
GameMessages::SendPlayAnimation(button, u"down"); RenderComponent::PlayAnimation(button, u"down");
// Setup a timer named 'buttonGoingDown' to be triggered in 5 seconds // Setup a timer named 'buttonGoingDown' to be triggered in 5 seconds
self->AddTimer("buttonGoingDown", 5.0f); self->AddTimer("buttonGoingDown", 5.0f);
@ -136,13 +137,13 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
// the anim of the button down is over // the anim of the button down is over
if (timerName == "buttonGoingDown") { if (timerName == "buttonGoingDown") {
// Play the 'up' animation // Play the 'up' animation
GameMessages::SendPlayAnimation(self, u"up"); RenderComponent::PlayAnimation(self, u"up");
// Setup a timer named 'CageOpen' to be triggered in 1 second // Setup a timer named 'CageOpen' to be triggered in 1 second
self->AddTimer("CageOpen", 1.0f); self->AddTimer("CageOpen", 1.0f);
} else if (timerName == "CageOpen") { } else if (timerName == "CageOpen") {
// play the idle open anim // play the idle open anim
GameMessages::SendPlayAnimation(self, u"idle-up"); RenderComponent::PlayAnimation(self, u"idle-up");
// Get the villeger // Get the villeger
auto* villager = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"villager")); auto* villager = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"villager"));
@ -199,13 +200,13 @@ void CavePrisonCage::OnTimerDone(Entity* self, std::string timerName) {
} }
// Play the 'up' animation on the button // Play the 'up' animation on the button
GameMessages::SendPlayAnimation(button, u"up"); RenderComponent::PlayAnimation(button, u"up");
// Setup a timer named 'CageClosed' to be triggered in 1 second // Setup a timer named 'CageClosed' to be triggered in 1 second
self->AddTimer("CageClosed", 1.0f); self->AddTimer("CageClosed", 1.0f);
} else if (timerName == "CageClosed") { } else if (timerName == "CageClosed") {
// play the idle closed anim // play the idle closed anim
GameMessages::SendPlayAnimation(self, u"idle"); RenderComponent::PlayAnimation(self, u"idle");
// Setup a timer named 'ResetPrison' to be triggered in 10 seconds // Setup a timer named 'ResetPrison' to be triggered in 10 seconds
self->AddTimer("ResetPrison", 10.0f); self->AddTimer("ResetPrison", 10.0f);

View File

@ -9,6 +9,7 @@
#include "SkillComponent.h" #include "SkillComponent.h"
#include "TeamManager.h" #include "TeamManager.h"
#include <algorithm> #include <algorithm>
#include "RenderComponent.h"
// // // // // // // // // // // // // //
// Event handling // // Event handling //
@ -261,7 +262,7 @@ void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* co
skillComponent->CalculateBehavior(1635, 39097, frakjaw->GetObjectID(), true, false); skillComponent->CalculateBehavior(1635, 39097, frakjaw->GetObjectID(), true, false);
} }
GameMessages::SendPlayAnimation(frakjaw, StunnedAnimation); RenderComponent::PlayAnimation(frakjaw, StunnedAnimation);
GameMessages::SendPlayNDAudioEmitter(frakjaw, UNASSIGNED_SYSTEM_ADDRESS, CounterSmashAudio); GameMessages::SendPlayNDAudioEmitter(frakjaw, UNASSIGNED_SYSTEM_ADDRESS, CounterSmashAudio);
// Before wave 4 we should lower frakjaw from the ledge // Before wave 4 we should lower frakjaw from the ledge
@ -281,7 +282,7 @@ void NjMonastryBossInstance::HandleCounterWeightSpawned(Entity* self, Entity* co
} }
void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* lowerFrakjaw) { void NjMonastryBossInstance::HandleLowerFrakjawSpawned(Entity* self, Entity* lowerFrakjaw) {
GameMessages::SendPlayAnimation(lowerFrakjaw, TeleportInAnimation); RenderComponent::PlayAnimation(lowerFrakjaw, TeleportInAnimation);
self->SetVar<LWOOBJID>(LowerFrakjawVariable, lowerFrakjaw->GetObjectID()); self->SetVar<LWOOBJID>(LowerFrakjawVariable, lowerFrakjaw->GetObjectID());
auto* combatAI = lowerFrakjaw->GetComponent<BaseCombatAIComponent>(); auto* combatAI = lowerFrakjaw->GetComponent<BaseCombatAIComponent>();
@ -401,7 +402,7 @@ void NjMonastryBossInstance::TeleportPlayer(Entity* player, uint32_t position) {
void NjMonastryBossInstance::SummonWave(Entity* self, Entity* frakjaw) { void NjMonastryBossInstance::SummonWave(Entity* self, Entity* frakjaw) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0, LWOOBJID_EMPTY, GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0, LWOOBJID_EMPTY,
LedgeFrakSummon, UNASSIGNED_SYSTEM_ADDRESS); LedgeFrakSummon, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayAnimation(frakjaw, SummonAnimation); RenderComponent::PlayAnimation(frakjaw, SummonAnimation);
// Stop the music for the first, fourth and fifth wave // Stop the music for the first, fourth and fifth wave
const auto wave = self->GetVar<uint32_t>(WaveNumberVariable); const auto wave = self->GetVar<uint32_t>(WaveNumberVariable);
@ -425,7 +426,7 @@ void NjMonastryBossInstance::LowerFrakjawSummon(Entity* self, Entity* frakjaw) {
GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0, GameMessages::SendNotifyClientObject(self->GetObjectID(), PlayCinematicNotification, 0, 0,
LWOOBJID_EMPTY, BottomFrakSummon, UNASSIGNED_SYSTEM_ADDRESS); LWOOBJID_EMPTY, BottomFrakSummon, UNASSIGNED_SYSTEM_ADDRESS);
ActivityTimerStart(self, SpawnWaveTimer, 2.0f, 2.0f); ActivityTimerStart(self, SpawnWaveTimer, 2.0f, 2.0f);
GameMessages::SendPlayAnimation(frakjaw, SummonAnimation); RenderComponent::PlayAnimation(frakjaw, SummonAnimation);
} }
void NjMonastryBossInstance::RemovePoison(Entity* self) { void NjMonastryBossInstance::RemovePoison(Entity* self) {
@ -444,7 +445,7 @@ void NjMonastryBossInstance::RemovePoison(Entity* self) {
} }
void NjMonastryBossInstance::LowerFrakjaw(Entity* self, Entity* frakjaw) { void NjMonastryBossInstance::LowerFrakjaw(Entity* self, Entity* frakjaw) {
GameMessages::SendPlayAnimation(frakjaw, TeleportOutAnimation); RenderComponent::PlayAnimation(frakjaw, TeleportOutAnimation);
ActivityTimerStart(self, LowerFrakjawCamTimer, 2.0f, 2.0f); ActivityTimerStart(self, LowerFrakjawCamTimer, 2.0f, 2.0f);
GameMessages::SendNotifyClientObject(frakjaw->GetObjectID(), StopMusicNotification, 0, 0, GameMessages::SendNotifyClientObject(frakjaw->GetObjectID(), StopMusicNotification, 0, 0,

View File

@ -1,6 +1,8 @@
#include "BaseConsoleTeleportServer.h" #include "BaseConsoleTeleportServer.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Player.h" #include "Player.h"
#include "RenderComponent.h"
#include "EntityManager.h"
void BaseConsoleTeleportServer::BaseOnUse(Entity* self, Entity* user) { void BaseConsoleTeleportServer::BaseOnUse(Entity* self, Entity* user) {
auto* player = user; auto* player = user;
@ -31,13 +33,12 @@ void BaseConsoleTeleportServer::BaseOnMessageBoxResponse(Entity* self, Entity* s
} }
const auto& teleIntroAnim = self->GetVar<std::u16string>(u"teleportAnim"); 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()) { if (!teleIntroAnim.empty()) {
GameMessages::SendPlayAnimation(player, teleIntroAnim); animTime = RenderComponent::PlayAnimation(player, teleIntroAnim);
} }
const auto animTime = 3.32999992370605f;
UpdatePlayerTable(self, player, true); UpdatePlayerTable(self, player, true);
const auto playerID = player->GetObjectID(); const auto playerID = player->GetObjectID();

View File

@ -5,6 +5,8 @@
#include "PhantomPhysicsComponent.h" #include "PhantomPhysicsComponent.h"
#include "RenderComponent.h" #include "RenderComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "Entity.h"
void AgFans::OnStartup(Entity* self) { void AgFans::OnStartup(Entity* self) {
self->SetVar<bool>(u"alive", true); self->SetVar<bool>(u"alive", true);
@ -34,7 +36,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return; if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
if (self->GetVar<bool>(u"on")) { if (self->GetVar<bool>(u"on")) {
GameMessages::SendPlayAnimation(self, u"fan-off"); RenderComponent::PlayAnimation(self, u"fan-off");
renderComponent->StopEffect("fanOn"); renderComponent->StopEffect("fanOn");
self->SetVar<bool>(u"on", false); self->SetVar<bool>(u"on", false);
@ -46,11 +48,11 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume); EntityManager::Instance()->SerializeEntity(volume);
if (!hit) { if (!hit) {
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0]; Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
GameMessages::SendPlayAnimation(fxObj, u"trigger"); RenderComponent::PlayAnimation(fxObj, u"trigger");
} }
} }
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) { } else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
GameMessages::SendPlayAnimation(self, u"fan-on"); RenderComponent::PlayAnimation(self, u"fan-on");
renderComponent->PlayEffect(495, u"fanOn", "fanOn"); renderComponent->PlayEffect(495, u"fanOn", "fanOn");
self->SetVar<bool>(u"on", true); self->SetVar<bool>(u"on", true);
@ -62,7 +64,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume); EntityManager::Instance()->SerializeEntity(volume);
if (!hit) { if (!hit) {
Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0]; Entity* fxObj = EntityManager::Instance()->GetEntitiesInGroup(fanGroup + "fx")[0];
GameMessages::SendPlayAnimation(fxObj, u"idle"); RenderComponent::PlayAnimation(fxObj, u"idle");
} }
} }
} }

View File

@ -3,6 +3,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
void AgJetEffectServer::OnUse(Entity* self, Entity* user) { void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
if (inUse) { if (inUse) {
@ -54,7 +55,7 @@ void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
const auto group = groups[0]; const auto group = groups[0];
GameMessages::SendPlayAnimation(effect, u"jetFX"); RenderComponent::PlayAnimation(effect, u"jetFX");
self->AddTimer("PlayEffect", 2.5f); self->AddTimer("PlayEffect", 2.5f);

View File

@ -1,11 +1,10 @@
#include "AgSalutingNpcs.h" #include "AgSalutingNpcs.h"
#include "GameMessages.h" #include "RenderComponent.h"
void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) { void AgSalutingNpcs::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
if (emote != 356) { if (emote != 356) {
return; return;
} }
GameMessages::SendPlayAnimation(self, u"salutePlayer"); RenderComponent::PlayAnimation(self, u"salutePlayer");
} }

View File

@ -1,5 +1,7 @@
#include "AgShipPlayerShockServer.h" #include "AgShipPlayerShockServer.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "RenderComponent.h"
#include "Entity.h"
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) { void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID()); GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
@ -7,7 +9,7 @@ void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
return; return;
} }
active = true; active = true;
GameMessages::SendPlayAnimation(user, shockAnim); RenderComponent::PlayAnimation(user, shockAnim);
GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, NiPoint3(-20, 10, -20)); GameMessages::SendKnockback(user->GetObjectID(), self->GetObjectID(), self->GetObjectID(), 0, NiPoint3(-20, 10, -20));
GameMessages::SendPlayFXEffect(self, 1430, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true); GameMessages::SendPlayFXEffect(self, 1430, u"create", "console_sparks", LWOOBJID_EMPTY, 1.0, 1.0, true);

View File

@ -3,6 +3,8 @@
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "RenderComponent.h"
#include "Entity.h"
void AgSpaceStuff::OnStartup(Entity* self) { void AgSpaceStuff::OnStartup(Entity* self) {
self->AddTimer("FloaterScale", 5.0f); self->AddTimer("FloaterScale", 5.0f);
@ -27,13 +29,13 @@ void AgSpaceStuff::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "FloaterScale") { if (timerName == "FloaterScale") {
int scaleType = GeneralUtils::GenerateRandomNumber<int>(1, 5); int scaleType = GeneralUtils::GenerateRandomNumber<int>(1, 5);
GameMessages::SendPlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType)); RenderComponent::PlayAnimation(self, u"scale_0" + GeneralUtils::to_u16string(scaleType));
self->AddTimer("FloaterPath", 0.4); self->AddTimer("FloaterPath", 0.4);
} else if (timerName == "FloaterPath") { } else if (timerName == "FloaterPath") {
int pathType = GeneralUtils::GenerateRandomNumber<int>(1, 4); int pathType = GeneralUtils::GenerateRandomNumber<int>(1, 4);
int randTime = GeneralUtils::GenerateRandomNumber<int>(20, 25); int randTime = GeneralUtils::GenerateRandomNumber<int>(20, 25);
GameMessages::SendPlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType))); RenderComponent::PlayAnimation(self, u"path_0" + (GeneralUtils::to_u16string(pathType)));
self->AddTimer("FloaterScale", randTime); self->AddTimer("FloaterScale", randTime);
} else if (timerName == "ShipShakeExplode") { } else if (timerName == "ShipShakeExplode") {
DoShake(self, true); DoShake(self, true);
@ -76,16 +78,16 @@ void AgSpaceStuff::DoShake(Entity* self, bool explodeIdle) {
auto* shipFxObject2 = GetEntityInGroup(ShipFX2); auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
if (shipFxObject2) if (shipFxObject2)
GameMessages::SendPlayAnimation(shipFxObject2, u"explosion"); RenderComponent::PlayAnimation(shipFxObject2, u"explosion");
} else { } else {
auto* shipFxObject = GetEntityInGroup(ShipFX); auto* shipFxObject = GetEntityInGroup(ShipFX);
auto* shipFxObject2 = GetEntityInGroup(ShipFX2); auto* shipFxObject2 = GetEntityInGroup(ShipFX2);
if (shipFxObject) if (shipFxObject)
GameMessages::SendPlayAnimation(shipFxObject, u"idle"); RenderComponent::PlayAnimation(shipFxObject, u"idle");
if (shipFxObject2) if (shipFxObject2)
GameMessages::SendPlayAnimation(shipFxObject2, u"idle"); RenderComponent::PlayAnimation(shipFxObject2, u"idle");
} }
} }

View File

@ -1,6 +1,8 @@
#include "FvDragonSmashingGolemQb.h" #include "FvDragonSmashingGolemQb.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "RenderComponent.h"
#include "Entity.h"
void FvDragonSmashingGolemQb::OnStartup(Entity* self) { void FvDragonSmashingGolemQb::OnStartup(Entity* self) {
self->AddTimer("GolemBreakTimer", 10.5f); self->AddTimer("GolemBreakTimer", 10.5f);
@ -14,7 +16,7 @@ void FvDragonSmashingGolemQb::OnTimerDone(Entity* self, std::string timerName) {
void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) { void FvDragonSmashingGolemQb::OnRebuildNotifyState(Entity* self, eRebuildState state) {
if (state == eRebuildState::REBUILD_COMPLETED) { if (state == eRebuildState::REBUILD_COMPLETED) {
GameMessages::SendPlayAnimation(self, u"dragonsmash"); RenderComponent::PlayAnimation(self, u"dragonsmash");
const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon"); const auto dragonId = self->GetVar<LWOOBJID>(u"Dragon");

View File

@ -3,6 +3,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "SkillComponent.h" #include "SkillComponent.h"
#include "GeneralUtils.h" #include "GeneralUtils.h"
#include "RenderComponent.h"
void FvFlyingCreviceDragon::OnStartup(Entity* self) { void FvFlyingCreviceDragon::OnStartup(Entity* self) {
self->AddTimer("waypoint", 5); self->AddTimer("waypoint", 5);
@ -67,10 +68,10 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
auto point = self->GetVar<int32_t>(u"waypoint"); auto point = self->GetVar<int32_t>(u"waypoint");
if (point == 4) { if (point == 4) {
GameMessages::SendPlayAnimation(self, u"attack1", 2); RenderComponent::PlayAnimation(self, u"attack1", 2.0f);
self->AddTimer("platform1attack", 1.75f); self->AddTimer("platform1attack", 1.75f);
} else if (point == 12) { } else if (point == 12) {
GameMessages::SendPlayAnimation(self, u"attack2", 2); RenderComponent::PlayAnimation(self, u"attack2", 2.0f);
const auto& group2 = EntityManager::Instance()->GetEntitiesInGroup("dragonFireballs2"); const auto& group2 = EntityManager::Instance()->GetEntitiesInGroup("dragonFireballs2");
@ -101,7 +102,7 @@ void FvFlyingCreviceDragon::OnArrived(Entity* self) {
} }
} }
} else if (point == 16) { } else if (point == 16) {
GameMessages::SendPlayAnimation(self, u"attack3", 2); RenderComponent::PlayAnimation(self, u"attack3", 2.0f);
self->AddTimer("platform3attack", 0.5f); self->AddTimer("platform3attack", 0.5f);
} }
} }

View File

@ -1,6 +1,8 @@
#include "FvNinjaGuard.h" #include "FvNinjaGuard.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "RenderComponent.h"
#include "EntityManager.h"
void FvNinjaGuard::OnStartup(Entity* self) { void FvNinjaGuard::OnStartup(Entity* self) {
if (self->GetLOT() == 7412) { if (self->GetLOT() == 7412) {
@ -12,24 +14,24 @@ void FvNinjaGuard::OnStartup(Entity* self) {
void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) { void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
if (emote != 392) { if (emote != 392) {
GameMessages::SendPlayAnimation(self, u"no"); RenderComponent::PlayAnimation(self, u"no");
return; return;
} }
GameMessages::SendPlayAnimation(self, u"scared"); RenderComponent::PlayAnimation(self, u"scared");
if (self->GetLOT() == 7412) { if (self->GetLOT() == 7412) {
auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard); auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard);
if (rightGuard != nullptr) { if (rightGuard != nullptr) {
GameMessages::SendPlayAnimation(rightGuard, u"laugh_rt"); RenderComponent::PlayAnimation(rightGuard, u"laugh_rt");
} }
} else if (self->GetLOT() == 11128) { } else if (self->GetLOT() == 11128) {
auto* leftGuard = EntityManager::Instance()->GetEntity(m_LeftGuard); auto* leftGuard = EntityManager::Instance()->GetEntity(m_LeftGuard);
if (leftGuard != nullptr) { if (leftGuard != nullptr) {
GameMessages::SendPlayAnimation(leftGuard, u"laugh_lt"); RenderComponent::PlayAnimation(leftGuard, u"laugh_lt");
} }
} }
} }

View File

@ -2,6 +2,7 @@
#include "Entity.h" #include "Entity.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "MissionComponent.h" #include "MissionComponent.h"
#include "RenderComponent.h"
#include "eMissionState.h" #include "eMissionState.h"
void LegoDieRoll::OnStartup(Entity* self) { void LegoDieRoll::OnStartup(Entity* self) {
@ -17,23 +18,23 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) {
switch (dieRoll) { switch (dieRoll) {
case 1: case 1:
GameMessages::SendPlayAnimation(self, u"roll-die-1"); RenderComponent::PlayAnimation(self, u"roll-die-1");
break; break;
case 2: case 2:
GameMessages::SendPlayAnimation(self, u"roll-die-2"); RenderComponent::PlayAnimation(self, u"roll-die-2");
break; break;
case 3: case 3:
GameMessages::SendPlayAnimation(self, u"roll-die-3"); RenderComponent::PlayAnimation(self, u"roll-die-3");
break; break;
case 4: case 4:
GameMessages::SendPlayAnimation(self, u"roll-die-4"); RenderComponent::PlayAnimation(self, u"roll-die-4");
break; break;
case 5: case 5:
GameMessages::SendPlayAnimation(self, u"roll-die-5"); RenderComponent::PlayAnimation(self, u"roll-die-5");
break; break;
case 6: case 6:
{ {
GameMessages::SendPlayAnimation(self, u"roll-die-6"); RenderComponent::PlayAnimation(self, u"roll-die-6");
// tracking the It's Truly Random Achievement // tracking the It's Truly Random Achievement
auto* owner = self->GetOwner(); auto* owner = self->GetOwner();
auto* missionComponent = owner->GetComponent<MissionComponent>(); auto* missionComponent = owner->GetComponent<MissionComponent>();

View File

@ -1,5 +1,7 @@
#include "GfOrgan.h" #include "GfOrgan.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void GfOrgan::OnUse(Entity* self, Entity* user) { void GfOrgan::OnUse(Entity* self, Entity* user) {
if (self->GetBoolean(u"bIsInUse")) { if (self->GetBoolean(u"bIsInUse")) {
@ -11,7 +13,7 @@ void GfOrgan::OnUse(Entity* self, Entity* user) {
self->SetBoolean(u"bIsInUse", true); self->SetBoolean(u"bIsInUse", true);
self->AddTimer("reset", 5.0f); self->AddTimer("reset", 5.0f);
GameMessages::SendPlayAnimation(user, u"jig"); RenderComponent::PlayAnimation(user, u"jig");
} }
void GfOrgan::OnTimerDone(Entity* self, std::string timerName) { void GfOrgan::OnTimerDone(Entity* self, std::string timerName) {

View File

@ -15,6 +15,7 @@
#include "InventoryComponent.h" #include "InventoryComponent.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "eReplicaComponentType.h" #include "eReplicaComponentType.h"
#include "RenderComponent.h"
void SGCannon::OnStartup(Entity* self) { void SGCannon::OnStartup(Entity* self) {
Game::logger->Log("SGCannon", "OnStartup"); Game::logger->Log("SGCannon", "OnStartup");
@ -508,17 +509,17 @@ void SGCannon::RecordPlayerScore(Entity* self) {
void SGCannon::PlaySceneAnimation(Entity* self, const std::u16string& animationName, bool onCannon, bool onPlayer, float_t priority) { void SGCannon::PlaySceneAnimation(Entity* self, const std::u16string& animationName, bool onCannon, bool onPlayer, float_t priority) {
for (auto* cannon : EntityManager::Instance()->GetEntitiesInGroup("cannongroup")) { for (auto* cannon : EntityManager::Instance()->GetEntitiesInGroup("cannongroup")) {
GameMessages::SendPlayAnimation(cannon, animationName, priority); RenderComponent::PlayAnimation(cannon, animationName, priority);
} }
if (onCannon) { if (onCannon) {
GameMessages::SendPlayAnimation(self, animationName, priority); RenderComponent::PlayAnimation(self, animationName, priority);
} }
if (onPlayer) { if (onPlayer) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable)); auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) { if (player != nullptr) {
GameMessages::SendPlayAnimation(player, animationName, priority); RenderComponent::PlayAnimation(player, animationName, priority);
} }
} }
} }

View File

@ -9,6 +9,7 @@
#include "MissionComponent.h" #include "MissionComponent.h"
#include "eMissionState.h" #include "eMissionState.h"
#include "eMissionTaskType.h" #include "eMissionTaskType.h"
#include "RenderComponent.h"
// Constants are at the bottom // Constants are at the bottom
@ -122,7 +123,7 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) {
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS); player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS); GameMessages::SendPlayCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS);
self->AddCallbackTimer(1.0f, [player, instrumentLot]() { self->AddCallbackTimer(1.0f, [player, instrumentLot]() {
GameMessages::SendPlayAnimation(player, animations.at(instrumentLot), 2.0f); RenderComponent::PlayAnimation(player, animations.at(instrumentLot), 2.0f);
}); });
for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) { for (auto* soundBox : EntityManager::Instance()->GetEntitiesInGroup("Audio-Concert")) {
@ -153,7 +154,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
} }
GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f); GameMessages::SendEndCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS, 1.0f);
GameMessages::SendPlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f); RenderComponent::PlayAnimation(player, smashAnimations.at(instrumentLot), 2.0f);
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stopCheckingMovement", 0, 0, GameMessages::SendNotifyClientObject(self->GetObjectID(), u"stopCheckingMovement", 0, 0,
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS); player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
} }

View File

@ -4,6 +4,8 @@
#include "GameMessages.h" #include "GameMessages.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "PhantomPhysicsComponent.h" #include "PhantomPhysicsComponent.h"
#include "RenderComponent.h"
#include "Entity.h"
void WhFans::OnStartup(Entity* self) { void WhFans::OnStartup(Entity* self) {
self->SetVar<bool>(u"alive", true); self->SetVar<bool>(u"alive", true);
@ -30,7 +32,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return; if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;
if (self->GetVar<bool>(u"on")) { if (self->GetVar<bool>(u"on")) {
GameMessages::SendPlayAnimation(self, u"fan-off"); RenderComponent::PlayAnimation(self, u"fan-off");
renderComponent->StopEffect("fanOn"); renderComponent->StopEffect("fanOn");
self->SetVar<bool>(u"on", false); self->SetVar<bool>(u"on", false);
@ -42,7 +44,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume); EntityManager::Instance()->SerializeEntity(volume);
} }
} else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) { } else if (!self->GetVar<bool>(u"on") && self->GetVar<bool>(u"alive")) {
GameMessages::SendPlayAnimation(self, u"fan-on"); RenderComponent::PlayAnimation(self, u"fan-on");
self->SetVar<bool>(u"on", true); self->SetVar<bool>(u"on", true);

View File

@ -1,6 +1,7 @@
#include "WildAmbients.h" #include "WildAmbients.h"
#include "GameMessages.h" #include "GameMessages.h"
#include "RenderComponent.h"
void WildAmbients::OnUse(Entity* self, Entity* user) { void WildAmbients::OnUse(Entity* self, Entity* user) {
GameMessages::SendPlayAnimation(self, u"interact"); RenderComponent::PlayAnimation(self, u"interact");
} }