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::Sleep,
MetricVariable::Frame,
MetricVariable::Database,
};
void Metrics::AddMeasurement(MetricVariable variable, int64_t value) {

View File

@ -20,6 +20,7 @@ enum class MetricVariable : int32_t
CPUTime,
Sleep,
Frame,
Database,
};
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
//#define CDCLIENT_CACHE_ALL
// Enable this to skip some unused columns in some tables
#define UNUSED(v)
/*!
\file CDClientDatabase.hpp
\brief An interface between the CDClient.sqlite file and the server

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,56 +1,84 @@
#include "CDAnimationsTable.h"
#include "GeneralUtils.h"
#include "Game.h"
CDAnimationsTable::CDAnimationsTable(void) {
bool CDAnimationsTable::CacheData(CppSQLite3Statement queryToCache) {
auto tableData = queryToCache.execQuery();
// If we received a bad lookup, cache it anyways so we do not run the query again.
if (tableData.eof()) return false;
// First, get the size of the table
unsigned int size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM Animations");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
do {
std::string animation_type = tableData.getStringField("animation_type", "");
DluAssert(!animation_type.empty());
AnimationGroupID animationGroupID = tableData.getIntField("animationGroupID", -1);
DluAssert(animationGroupID != -1);
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
this->entries.reserve(size);
// Now get the data
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM Animations");
while (!tableData.eof()) {
CDAnimations entry;
entry.animationGroupID = tableData.getIntField("animationGroupID", -1);
entry.animation_type = tableData.getStringField("animation_type", "");
CDAnimation entry;
entry.animation_name = tableData.getStringField("animation_name", "");
entry.chance_to_play = tableData.getFloatField("chance_to_play", -1.0f);
entry.min_loops = tableData.getIntField("min_loops", -1);
entry.max_loops = tableData.getIntField("max_loops", -1);
entry.animation_length = tableData.getFloatField("animation_length", -1.0f);
entry.hideEquip = tableData.getIntField("hideEquip", -1) == 1 ? true : false;
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", -1) == 1 ? true : false;
entry.restartable = tableData.getIntField("restartable", -1) == 1 ? true : false;
entry.chance_to_play = tableData.getFloatField("chance_to_play", 1.0f);
entry.min_loops = tableData.getIntField("min_loops", 0);
entry.max_loops = tableData.getIntField("max_loops", 0);
entry.animation_length = tableData.getFloatField("animation_length", 0.0f);
entry.hideEquip = tableData.getIntField("hideEquip", 0) == 1;
entry.ignoreUpperBody = tableData.getIntField("ignoreUpperBody", 0) == 1;
entry.restartable = tableData.getIntField("restartable", 0) == 1;
entry.face_animation_name = tableData.getStringField("face_animation_name", "");
entry.priority = tableData.getFloatField("priority", -1.0f);
entry.blendTime = tableData.getFloatField("blendTime", -1.0f);
entry.priority = tableData.getFloatField("priority", 0.0f);
entry.blendTime = tableData.getFloatField("blendTime", 0.0f);
this->entries.push_back(entry);
this->animations[CDAnimationKey(animation_type, animationGroupID)].push_back(entry);
tableData.nextRow();
}
} while (!tableData.eof());
tableData.finalize();
return true;
}
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
std::vector<CDAnimations> data = cpplinq::from(this->entries)
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;
void CDAnimationsTable::CacheAnimations(const CDAnimationKey animationKey) {
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ? and animation_type = ?");
query.bind(1, static_cast<int32_t>(animationKey.second));
query.bind(2, animationKey.first.c_str());
// If we received a bad lookup, cache it anyways so we do not run the query again.
if (!CacheData(query)) {
this->animations[animationKey];
}
}
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
return this->entries;
void CDAnimationsTable::CacheAnimationGroup(AnimationGroupID animationGroupID) {
auto animationEntryCached = this->animations.find(CDAnimationKey("", animationGroupID));
if (animationEntryCached != this->animations.end()) {
return;
}
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM Animations WHERE animationGroupID = ?");
query.bind(1, static_cast<int32_t>(animationGroupID));
// Cache the query so we don't run the query again.
CacheData(query);
this->animations[CDAnimationKey("", animationGroupID)];
}
CDAnimationLookupResult CDAnimationsTable::GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID) {
CDAnimationKey animationKey(animationType, animationGroupID);
auto randomAnimation = GeneralUtils::GenerateRandomNumber<float>(0, 1);
auto animationEntryCached = this->animations.find(animationKey);
if (animationEntryCached == this->animations.end()) {
this->CacheAnimations(animationKey);
}
auto animationEntry = this->animations.find(animationKey);
// If we have only one animation, return it regardless of the chance to play.
if (animationEntry->second.size() == 1) {
return CDAnimationLookupResult(animationEntry->second.front());
}
for (auto& animationEntry : animationEntry->second) {
randomAnimation -= animationEntry.chance_to_play;
// This is how the client gets the random animation.
if (animationEntry.animation_name != previousAnimationName && randomAnimation <= 0.0f) return CDAnimationLookupResult(animationEntry);
}
return CDAnimationLookupResult();
}

View File

@ -3,9 +3,10 @@
// Custom Classes
#include "CDTable.h"
struct CDAnimations {
unsigned int animationGroupID; //!< The animation group ID
std::string animation_type; //!< The animation type
struct CDAnimation {
// unsigned int animationGroupID;
// std::string animation_type;
// The above two are a pair to represent a primary key in the map.
std::string animation_name; //!< The animation name
float chance_to_play; //!< The chance to play the animation
unsigned int min_loops; //!< The minimum number of loops
@ -19,15 +20,20 @@ struct CDAnimations {
float blendTime; //!< The blend time
};
typedef LookupResult<CDAnimation> CDAnimationLookupResult;
class CDAnimationsTable : public CDTable<CDAnimationsTable> {
private:
std::vector<CDAnimations> entries;
typedef int32_t AnimationGroupID;
typedef std::string AnimationID;
typedef std::pair<std::string, AnimationGroupID> CDAnimationKey;
public:
CDAnimationsTable();
// Queries the table with a custom "where" clause
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
std::vector<CDAnimations> GetEntries(void) const;
CDAnimationLookupResult GetAnimation(const AnimationID& animationType, const std::string& previousAnimationName, const AnimationGroupID animationGroupID);
void CacheAnimationGroup(AnimationGroupID animationGroupID);
private:
void CacheAnimations(const CDAnimationKey animationKey);
bool CacheData(CppSQLite3Statement queryToCache);
/**
* Each animation type has a vector of animations. This is because there can be animations have a percent chance to play so one is selected at random.
*/
std::map<CDAnimationKey, std::vector<CDAnimation>> animations;
};

View File

@ -1,93 +1,31 @@
#include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.h"
#include "dLogger.h"
#include "Game.h"
#define CDCLIENT_CACHE_ALL
uint64_t CalculateId(uint64_t lhs, uint64_t rhs) {
return (lhs << 32) | rhs;
}
CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
void CDComponentsRegistryTable::ReadRow(CppSQLite3Query& rowData) {
uint32_t id = rowData.getIntField("id", -1);
eReplicaComponentType component_type = static_cast<eReplicaComponentType>(rowData.getIntField("component_type", 0));
uint32_t component_id = rowData.getIntField("component_id", -1);
#ifdef CDCLIENT_CACHE_ALL
// First, get the size of the table
unsigned int size = 0;
auto tableSize = CDClientDatabase::ExecuteQuery("SELECT COUNT(*) FROM ComponentsRegistry");
while (!tableSize.eof()) {
size = tableSize.getIntField(0, 0);
auto insertedEntry = this->mappedEntries.insert_or_assign(CalculateId(id, static_cast<uint64_t>(component_type)), component_id);
DluAssert(insertedEntry.second == true);
}
tableSize.nextRow();
}
tableSize.finalize();
// Reserve the size
//this->entries.reserve(size);
// Now get the data
CDComponentsRegistryTable::CDComponentsRegistryTable() {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM ComponentsRegistry");
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1);
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
ReadRow(tableData);
tableData.nextRow();
}
tableData.finalize();
#endif
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
if (iter == this->mappedEntries.end()) {
return defaultValue;
}
return iter->second;
#ifndef CDCLIENT_CACHE_ALL
// Now get the data
std::stringstream query;
query << "SELECT * FROM ComponentsRegistry WHERE id = " << std::to_string(id);
auto tableData = CDClientDatabase::ExecuteQuery(query.str());
while (!tableData.eof()) {
CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1);
entry.component_type = tableData.getIntField("component_type", -1);
entry.component_id = tableData.getIntField("component_id", -1);
//this->entries.push_back(entry);
//Darwin's stuff:
const auto& it = this->mappedEntries.find(entry.id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(entry.component_type);
if (iter == it->second.end()) {
it->second.insert(std::make_pair(entry.component_type, entry.component_id));
}
} else {
std::map<unsigned int, unsigned int> map;
map.insert(std::make_pair(entry.component_type, entry.component_id));
this->mappedEntries.insert(std::make_pair(entry.id, map));
}
tableData.nextRow();
}
tableData.finalize();
const auto& it2 = this->mappedEntries.find(id);
if (it2 != mappedEntries.end()) {
const auto& iter = it2->second.find(componentType);
if (iter != it2->second.end()) {
return iter->second;
}
}
return defaultValue;
#endif
const auto iter = this->mappedEntries.find(CalculateId(id, static_cast<uint64_t>(componentType)));
return iter != this->mappedEntries.end() ? iter->second : defaultValue;
}

View File

@ -1,21 +1,15 @@
#pragma once
// Custom Classes
#include "CDTable.h"
enum class eReplicaComponentType : uint32_t;
struct CDComponentsRegistry {
unsigned int id; //!< The LOT is used as the ID
eReplicaComponentType component_type; //!< See ComponentTypes enum for values
unsigned int component_id; //!< The ID used within the component's table (0 may either mean it's non-networked, or that the ID is actually 0
};
class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
private:
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
public:
CDComponentsRegistryTable();
int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
private:
void ReadRow(CppSQLite3Query& rowData);
private:
std::unordered_map<uint64_t, uint32_t> mappedEntries;
};

View File

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

View File

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

View File

@ -29,7 +29,7 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
entry.maxToDrop = tableData.getIntField("maxToDrop", -1);
entry.id = tableData.getIntField("id", -1);
entry.flagID = tableData.getIntField("flagID", -1);
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
this->entries.push_back(entry);
tableData.nextRow();

View File

@ -12,7 +12,7 @@ struct CDLootMatrix {
unsigned int maxToDrop; //!< The maximum amount of loot from this matrix to drop
unsigned int id; //!< The ID of the Loot Matrix
unsigned int flagID; //!< ???
UNUSED(std::string gate_version); //!< The Gate Version
UNUSED_COLUMN(std::string gate_version); //!< The Gate Version
};
class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {

View File

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

View File

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

View File

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

View File

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

View File

@ -65,18 +65,18 @@ const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
CDObjects entry;
entry.id = tableData.getIntField("id", -1);
entry.name = tableData.getStringField("name", "");
UNUSED(entry.placeable = tableData.getIntField("placeable", -1));
UNUSED_COLUMN(entry.placeable = tableData.getIntField("placeable", -1));
entry.type = tableData.getStringField("type", "");
UNUSED(ntry.description = tableData.getStringField(4, ""));
UNUSED(entry.localize = tableData.getIntField("localize", -1));
UNUSED(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
UNUSED(entry.displayName = tableData.getStringField("displayName", ""));
UNUSED_COLUMN(ntry.description = tableData.getStringField(4, ""));
UNUSED_COLUMN(entry.localize = tableData.getIntField("localize", -1));
UNUSED_COLUMN(entry.npcTemplateID = tableData.getIntField("npcTemplateID", -1));
UNUSED_COLUMN(entry.displayName = tableData.getStringField("displayName", ""));
entry.interactionDistance = tableData.getFloatField("interactionDistance", -1.0f);
UNUSED(entry.nametag = tableData.getIntField("nametag", -1));
UNUSED(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
UNUSED(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
UNUSED_COLUMN(entry.nametag = tableData.getIntField("nametag", -1));
UNUSED_COLUMN(entry._internalNotes = tableData.getStringField("_internalNotes", ""));
UNUSED_COLUMN(entry.locStatus = tableData.getIntField("locStatus", -1));
UNUSED_COLUMN(entry.gate_version = tableData.getStringField("gate_version", ""));
UNUSED_COLUMN(entry.HQ_valid = tableData.getIntField("HQ_valid", -1));
this->entries.insert(std::make_pair(entry.id, entry));
tableData.nextRow();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,6 +2,7 @@
#include "CDClientDatabase.h"
#include "Singleton.h"
#include "DluAssert.h"
#include <functional>
#include <string>
@ -15,6 +16,9 @@
#endif
#include "cpplinq.hpp"
// Enable this to skip some unused columns in some tables
#define UNUSED_COLUMN(v)
#pragma warning (disable : 4244) //Disable double to float conversion warnings
#pragma warning (disable : 4715) //Disable "not all control paths return a value"
@ -23,3 +27,15 @@ class CDTable : public Singleton<Table> {
protected:
virtual ~CDTable() = default;
};
template<class T>
class LookupResult {
typedef std::pair<T, bool> DataType;
public:
LookupResult() { m_data.first = T(); m_data.second = false; };
LookupResult(T& data) { m_data.first = data; m_data.second = true; };
inline const T& Data() { return m_data.first; };
inline const bool& FoundData() { return m_data.second; };
private:
DataType m_data;
};

View File

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

View File

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

View File

@ -592,8 +592,9 @@ void Entity::Initialize() {
m_Components.insert(std::make_pair(eReplicaComponentType::BOUNCER, comp));
}
if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER) > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this);
int32_t renderaComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER);
if ((renderaComponentId > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this, renderaComponentId);
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) {
auto* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
std::vector<CDActivities> activities = activitiesTable->Query([=](const CDActivities& entry) {
return (entry.ActivityID == gameID);
});
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
auto activityResult = activitiesTable->GetActivity(gameID);
for (const auto& activity : activities) {
return static_cast<LeaderboardType>(activity.leaderboardType);
if (activityResult.FoundData()) {
return static_cast<LeaderboardType>(activityResult.Data().leaderboardType);
}
return LeaderboardType::None;

View File

@ -22,7 +22,7 @@
#include "Database.h"
#include "EntityInfo.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{};
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::SendPlayAnimation(tamer, u"rebuild-celebrate");
RenderComponent::PlayAnimation(tamer, u"rebuild-celebrate");
EntityInfo info{};
info.lot = cached->second.puzzleModelLot;

View File

@ -7,6 +7,8 @@
#include "RebuildComponent.h"
#include "Game.h"
#include "dLogger.h"
#include "RenderComponent.h"
#include "EntityManager.h"
RailActivatorComponent::RailActivatorComponent(Entity* parent, int32_t componentID) : Component(parent) {
m_ComponentID = componentID;
@ -56,23 +58,10 @@ void RailActivatorComponent::OnUse(Entity* originator) {
GameMessages::SendPlayFXEffect(originator->GetObjectID(), m_StartEffect.first, m_StartEffect.second,
std::to_string(m_StartEffect.first));
}
float animationLength = 0.5f;
if (!m_StartAnimation.empty()) {
GameMessages::SendPlayAnimation(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;
animationLength = RenderComponent::PlayAnimation(originator, m_StartAnimation);
}
const auto originatorID = originator->GetObjectID();
@ -111,7 +100,7 @@ void RailActivatorComponent::OnRailMovementReady(Entity* originator) const {
}
if (!m_LoopAnimation.empty()) {
GameMessages::SendPlayAnimation(originator, m_LoopAnimation);
RenderComponent::PlayAnimation(originator, m_LoopAnimation);
}
GameMessages::SendSetRailMovement(originator->GetObjectID(), m_PathDirection, m_Path, m_PathStart,
@ -146,7 +135,7 @@ void RailActivatorComponent::OnCancelRailMovement(Entity* originator) {
}
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

View File

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

View File

@ -11,72 +11,34 @@
#include "GameMessages.h"
#include "Game.h"
#include "dLogger.h"
#include "CDAnimationsTable.h"
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_LastAnimationName = "";
auto query = CDClientDatabase::CreatePreppedStmt("SELECT * FROM RenderComponent WHERE id = ?;");
query.bind(1, componentId);
auto result = query.execQuery();
return;
/*
auto* table = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
const auto entry = table->GetByIDAndType(parent->GetLOT(), eReplicaComponentType::RENDER);
std::stringstream query;
query << "SELECT effect1, effect2, effect3, effect4, effect5, effect6 FROM RenderComponent WHERE id = " << std::to_string(entry) << ";";
auto result = CDClientDatabase::ExecuteQuery(query.str());
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();
if (!result.eof()) {
auto animationGroupIDs = std::string(result.getStringField("animationGroupIDs", ""));
if (!animationGroupIDs.empty()) {
auto* animationsTable = CDClientManager::Instance().GetTable<CDAnimationsTable>();
auto groupIdsSplit = GeneralUtils::SplitString(animationGroupIDs, ',');
for (auto& groupId : groupIdsSplit) {
int32_t groupIdInt;
if (!GeneralUtils::TryParse(groupId, groupIdInt)) {
Game::logger->Log("RenderComponent", "bad animation group Id %s", groupId.c_str());
continue;
}
m_animationGroupIds.push_back(groupIdInt);
animationsTable->CacheAnimationGroup(groupIdInt);
}
}
}
result.finalize();
*/
}
RenderComponent::~RenderComponent() {
@ -224,3 +186,47 @@ void RenderComponent::StopEffect(const std::string& name, const bool killImmedia
std::vector<Effect*>& RenderComponent::GetEffects() {
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:
static const eReplicaComponentType ComponentType = eReplicaComponentType::RENDER;
RenderComponent(Entity* entity);
RenderComponent(Entity* entity, int32_t componentId = -1);
~RenderComponent() override;
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
@ -104,6 +104,16 @@ public:
*/
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:
/**
@ -111,6 +121,11 @@ private:
*/
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
*/

View File

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

View File

@ -15,13 +15,18 @@
#include "CDActivitiesTable.h"
class ScriptedActivityComponent;
/**
* Represents an instance of an activity, having participants and score
*/
class ActivityInstance {
public:
ActivityInstance(Entity* parent, CDActivities activityInfo) { m_Parent = parent; m_ActivityInfo = activityInfo; };
//~ActivityInstance();
ActivityInstance(Entity* parent, ScriptedActivityComponent* parentComponent, CDActivities activityInfo) {
m_Parent = parent;
m_OwningComponent = parentComponent;
m_ActivityInfo = activityInfo;
};
/**
* Adds an entity to this activity
@ -88,6 +93,11 @@ private:
*/
Entity* m_Parent;
/**
* The component that owns this activity (the ScriptedActivityComponent)
*/
ScriptedActivityComponent* m_OwningComponent;
/**
* All the participants of this activity
*/
@ -212,7 +222,7 @@ public:
* Returns 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

View File

@ -1,6 +1,7 @@
#include "SwitchComponent.h"
#include "EntityManager.h"
#include "eTriggerEventType.h"
#include "RenderComponent.h"
std::vector<SwitchComponent*> SwitchComponent::petSwitches;
@ -59,7 +60,7 @@ void SwitchComponent::EntityEnter(Entity* entity) {
if (m_PetBouncer != nullptr) {
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);
} else {
EntityManager::Instance()->SerializeEntity(m_Parent);

View File

@ -34,6 +34,7 @@
#include "eRacingTaskParam.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "RenderComponent.h"
#include <sstream>
#include <future>
@ -5110,7 +5111,7 @@ void GameMessages::HandlePlayEmote(RakNet::BitStream* inStream, Entity* entity)
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) {

View File

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

View File

@ -76,6 +76,7 @@
#include "TriggerComponent.h"
#include "eServerDisconnectIdentifiers.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "CDObjectsTable.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) {
std::u16string anim = GeneralUtils::ASCIIToUTF16(args[0], args[0].size());
GameMessages::SendPlayAnimation(entity, anim);
RenderComponent::PlayAnimation(entity, anim);
auto* possessorComponent = entity->GetComponent<PossessorComponent>();
if (possessorComponent) {
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);
} 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") {
for (auto* entry : closest->GetSettings()) {
ChatPackets::SendSystemMessage(sysAddr, GeneralUtils::UTF8ToUTF16(entry->GetString()));

View File

@ -49,6 +49,7 @@ namespace Game {
dConfig* config = nullptr;
AssetManager* assetManager = nullptr;
bool shouldShutdown = false;
std::mt19937 randomEngine;
} //namespace Game
bool shutdownSequenceStarted = false;
@ -290,6 +291,7 @@ int main(int argc, char** argv) {
return EXIT_SUCCESS;
}
Game::randomEngine = std::mt19937(time(0));
uint32_t maxClients = 999;
uint32_t ourPort = 1000;
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") {
StartChatServer();
Game::im->GetInstance(0, false, 0);
Game::im->GetInstance(1000, false, 0);
Game::im->GetInstance(1800, false, 0);
StartAuthServer();
}

View File

@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "dServer.h"
#include "VanityUtilities.h"
#include "RenderComponent.h"
void DLUVanityNPC::OnStartup(Entity* self) {
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) {
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"teleportRings", "teleportRings");

View File

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

View File

@ -7,6 +7,7 @@
#include "BaseCombatAIComponent.h"
#include "EntityInfo.h"
#include "eAninmationFlags.h"
#include "RenderComponent.h"
void AmDarklingDragon::OnStartup(Entity* self) {
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);
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 forward = self->GetRotation().GetForwardVector();
@ -121,9 +122,9 @@ void AmDarklingDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
@ -153,5 +154,5 @@ void AmDarklingDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::
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 "eAninmationFlags.h"
#include "EntityInfo.h"
#include "RenderComponent.h"
void FvMaelstromDragon::OnStartup(Entity* self) {
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);
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 forward = self->GetRotation().GetForwardVector();
@ -137,10 +138,10 @@ void FvMaelstromDragon::OnTimerDone(Entity* self, std::string timerName) {
} else if (timerName == "ExposeWeakSpotTimer") {
self->SetVar<int32_t>(u"weakspot", 1);
} else if (timerName == "timeToStunLoop") {
GameMessages::SendPlayAnimation(self, u"stunloop", 1.8f);
RenderComponent::PlayAnimation(self, u"stunloop", 1.8f);
} else if (timerName == "ReviveTimer") {
GameMessages::SendPlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1);
RenderComponent::PlayAnimation(self, u"stunend", 2.0f);
self->AddTimer("backToAttack", 1.0f);
} else if (timerName == "backToAttack") {
auto* baseCombatAIComponent = self->GetComponent<BaseCombatAIComponent>();
auto* skillComponent = self->GetComponent<SkillComponent>();
@ -174,5 +175,5 @@ FvMaelstromDragon::OnFireEventServerSide(Entity* self, Entity* sender, std::stri
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 "SkillComponent.h"
#include "eAninmationFlags.h"
#include "RenderComponent.h"
void BaseEnemyApe::OnStartup(Entity* self) {
self->SetVar<uint32_t>(u"timesStunned", 2);
@ -37,7 +38,7 @@ void BaseEnemyApe::OnHit(Entity* self, Entity* attacker) {
if (skillComponent) {
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);
const auto reviveTime = self->GetVar<float_t>(u"reviveTime") != 0.0f
? self->GetVar<float_t>(u"reviveTime") : 12.0f;

View File

@ -1,6 +1,8 @@
#include "GfApeSmashingQB.h"
#include "EntityManager.h"
#include "GameMessages.h"
#include "Entity.h"
#include "RenderComponent.h"
void GfApeSmashingQB::OnStartup(Entity* self) {
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"));
if (ape != nullptr) {
ape->OnFireEventServerSide(target, "rebuildDone");
GameMessages::SendPlayAnimation(self, u"smash", 1.7f);
RenderComponent::PlayAnimation(self, u"smash", 1.7f);
self->AddTimer("anchorBreakTime", 1.0f);
}
}

View File

@ -4,19 +4,15 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
void MaestromExtracticatorServer::OnStartup(Entity* self) {
//self:SetNetworkVar("current_anim", failAnim)
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
self->AddTimer("PlayFail", defaultTime);
self->AddTimer("PlayFail", RenderComponent::PlayAnimation(self, failAnim));
self->AddTimer("RemoveSample", destroyAfterNoSampleTime);
}
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1,
int32_t param2, int32_t param3) {
if (sender == nullptr)
return;
void MaestromExtracticatorServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (sender == nullptr) return;
if (args == "attemptCollection") {
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) {
PlayAnimAndReturnTime(self, collectAnim);
self->AddTimer("RemoveSample", defaultTime);
self->AddTimer("RemoveSample", PlayAnimAndReturnTime(self, collectAnim));
}
void MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(animID));
float MaestromExtracticatorServer::PlayAnimAndReturnTime(Entity* self, std::string animID) {
return RenderComponent::PlayAnimation(self, animID);
}
void MaestromExtracticatorServer::OnTimerDone(Entity* self, std::string timerName) {
if (timerName == "RemoveSample") {
self->ScheduleKillAfterUpdate();
}
if (timerName == "PlayFail") {
GameMessages::SendPlayAnimation(self, GeneralUtils::ASCIIToUTF16(failAnim));
} else if (timerName == "PlayFail") {
RenderComponent::PlayAnimation(self, failAnim);
}
}

View File

@ -7,12 +7,11 @@ public:
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2,
int32_t param3);
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);
private:
const std::string failAnim = "idle_maelstrom";
const std::string collectAnim = "collect_maelstrom";
const float defaultTime = 4.0f;
const float destroyAfterNoSampleTime = 8.0f;
};

View File

@ -1,5 +1,8 @@
#include "AgMonumentBirds.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.
@ -16,7 +19,7 @@ void AgMonumentBirds::OnProximityUpdate(Entity* self, Entity* entering, std::str
if (name == "MonumentBirds" && status == "ENTER") {
self->AddTimer("killBird", 1.0f);
GameMessages::SendPlayAnimation(self, sOnProximityAnim);
RenderComponent::PlayAnimation(self, sOnProximityAnim);
self->SetVar<bool>(u"IsFlying", true);
self->SetVar<LWOOBJID>(u"PlayerID", entering->GetObjectID());
}

View File

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

View File

@ -1,6 +1,8 @@
#include "AmSkullkinDrillStand.h"
#include "GameMessages.h"
#include "dpEntity.h"
#include "Entity.h"
#include "RenderComponent.h"
void AmSkullkinDrillStand::OnStartup(Entity* self) {
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::SendPlayAnimation(entering, u"knockback-recovery");
RenderComponent::PlayAnimation(entering, u"knockback-recovery");
}

View File

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

View File

@ -2,6 +2,7 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
void GfCaptainsCannon::OnUse(Entity* self, Entity* user) {
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::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);
@ -58,7 +59,7 @@ void GfCaptainsCannon::OnTimerDone(Entity* self, std::string timerName) {
for (auto* shark : sharkObjects) {
if (shark->GetLOT() != m_SharkItemID) continue;
GameMessages::SendPlayAnimation(shark, u"cannon");
RenderComponent::PlayAnimation(shark, u"cannon");
}
GameMessages::SendPlay2DAmbientSound(player, "{7457d85c-4537-4317-ac9d-2f549219ea87}");

View File

@ -5,6 +5,7 @@
#include "RenderComponent.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
void GfTikiTorch::OnStartup(Entity* self) {
LightTorch(self);
@ -16,7 +17,7 @@ void GfTikiTorch::OnUse(Entity* self, Entity* killer) {
return;
}
GameMessages::SendPlayAnimation(self, u"interact");
RenderComponent::PlayAnimation(self, u"interact");
self->SetI64(u"userID", killer->GetObjectID());
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) {
if (self->GetBoolean(u"isBurning") && message == "waterspray") {
GameMessages::SendPlayAnimation(self, u"water");
RenderComponent::PlayAnimation(self, u"water");
auto* renderComponent = self->GetComponent<RenderComponent>();
if (renderComponent != nullptr) {

View File

@ -8,6 +8,7 @@
#define _USE_MATH_DEFINES
#include <math.h>
#endif
#include "RenderComponent.h"
void MastTeleport::OnStartup(Entity* self) {
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::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") {
GameMessages::SendStopFXEffect(player, true, "hook");

View File

@ -4,6 +4,7 @@
#include "MissionComponent.h"
#include "SkillComponent.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.
//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) {
/*
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>();
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 (status == "ENTER") {
GameMessages::SendPlayAnimation(self, u"bounce");
RenderComponent::PlayAnimation(self, u"bounce");
GameMessages::SendPlayFXEffect(self, -1, u"anim", "bouncin", LWOOBJID_EMPTY, 1, 1, true);
self->SetVar(u"playersNearChest", self->GetVar<int32_t>(u"playersNearChest") + 1);
} else if (status == "LEAVE") {
self->SetVar(u"playersNearChest", 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");
self->SetVar<int32_t>(u"playersNearChest", 0);
}

View File

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

View File

@ -4,6 +4,7 @@
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "eMissionState.h"
#include "RenderComponent.h"
void NtAssemblyTubeServer::OnStartup(Entity* self) {
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;
@ -82,7 +83,7 @@ void NtAssemblyTubeServer::TeleportPlayer(Entity* self, Entity* player) {
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;

View File

@ -4,6 +4,7 @@
#include "EntityManager.h"
#include "Character.h"
#include "eMissionState.h"
#include "RenderComponent.h"
void NtParadoxPanelServer::OnUse(Entity* self, Entity* user) {
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);
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::SendSetStunned(player->GetObjectID(), eStateChangeType::POP, player->GetSystemAddress(), LWOOBJID_EMPTY, false, false, true, false, true, true, false, false, true);
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);
return;
}
GameMessages::SendPlayAnimation(user, shockAnim);
RenderComponent::PlayAnimation(user, shockAnim);
const auto dir = self->GetRotation().GetRightVector();

View File

@ -3,6 +3,7 @@
#include "EntityManager.h"
#include "MissionComponent.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
void NtParadoxTeleServer::OnStartup(Entity* self) {
self->SetProximityRadius(5, "teleport");
@ -27,7 +28,7 @@ void NtParadoxTeleServer::OnProximityUpdate(Entity* self, Entity* entering, std:
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;
@ -73,7 +74,7 @@ void NtParadoxTeleServer::TeleportPlayer(Entity* self, Entity* player) {
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;

View File

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

View File

@ -1,6 +1,9 @@
#include "NtVentureCannonServer.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "Entity.h"
#include "GeneralUtils.h"
#include "RenderComponent.h"
void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
auto* player = user;
@ -26,7 +29,7 @@ void NtVentureCannonServer::OnUse(Entity* self, Entity* user) {
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;
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::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 "GameMessages.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) {
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
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}");
// set the art so we can use it again
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
auto animTime = 1;
self->AddTimer("resetArm", animTime);
GameMessages::SendPlayAnimation(arm, u"launch");
RenderComponent::PlayAnimation(arm, u"launch");
} else if (timerName == "bounce") {
auto* bouncer = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(u"Bouncer"));
if (bouncer == nullptr) return;
@ -52,7 +54,7 @@ void CatapultBaseServer::OnTimerDone(Entity* self, std::string timerName) {
if (arm == nullptr) return;
// 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"));
if (bouncer == nullptr) return;

View File

@ -4,6 +4,7 @@
#include "GameMessages.h"
#include "Character.h"
#include "dZoneManager.h"
#include "RenderComponent.h"
void CavePrisonCage::OnStartup(Entity* self) {
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
GameMessages::SendPlayAnimation(button, u"down");
RenderComponent::PlayAnimation(button, u"down");
// Setup a timer named 'buttonGoingDown' to be triggered in 5 seconds
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
if (timerName == "buttonGoingDown") {
// 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
self->AddTimer("CageOpen", 1.0f);
} else if (timerName == "CageOpen") {
// play the idle open anim
GameMessages::SendPlayAnimation(self, u"idle-up");
RenderComponent::PlayAnimation(self, u"idle-up");
// Get the villeger
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
GameMessages::SendPlayAnimation(button, u"up");
RenderComponent::PlayAnimation(button, u"up");
// Setup a timer named 'CageClosed' to be triggered in 1 second
self->AddTimer("CageClosed", 1.0f);
} else if (timerName == "CageClosed") {
// 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
self->AddTimer("ResetPrison", 10.0f);

View File

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

View File

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

View File

@ -5,6 +5,8 @@
#include "PhantomPhysicsComponent.h"
#include "RenderComponent.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
#include "Entity.h"
void AgFans::OnStartup(Entity* self) {
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 (self->GetVar<bool>(u"on")) {
GameMessages::SendPlayAnimation(self, u"fan-off");
RenderComponent::PlayAnimation(self, u"fan-off");
renderComponent->StopEffect("fanOn");
self->SetVar<bool>(u"on", false);
@ -46,11 +48,11 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume);
if (!hit) {
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")) {
GameMessages::SendPlayAnimation(self, u"fan-on");
RenderComponent::PlayAnimation(self, u"fan-on");
renderComponent->PlayEffect(495, u"fanOn", "fanOn");
self->SetVar<bool>(u"on", true);
@ -62,7 +64,7 @@ void AgFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume);
if (!hit) {
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 "SkillComponent.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
void AgJetEffectServer::OnUse(Entity* self, Entity* user) {
if (inUse) {
@ -54,7 +55,7 @@ void AgJetEffectServer::OnRebuildComplete(Entity* self, Entity* target) {
const auto group = groups[0];
GameMessages::SendPlayAnimation(effect, u"jetFX");
RenderComponent::PlayAnimation(effect, u"jetFX");
self->AddTimer("PlayEffect", 2.5f);

View File

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

View File

@ -1,5 +1,7 @@
#include "AgShipPlayerShockServer.h"
#include "GameMessages.h"
#include "RenderComponent.h"
#include "Entity.h"
void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
GameMessages::SendTerminateInteraction(user->GetObjectID(), eTerminateType::FROM_INTERACTION, self->GetObjectID());
@ -7,7 +9,7 @@ void AgShipPlayerShockServer::OnUse(Entity* self, Entity* user) {
return;
}
active = true;
GameMessages::SendPlayAnimation(user, shockAnim);
RenderComponent::PlayAnimation(user, shockAnim);
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);

View File

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

View File

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

View File

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

View File

@ -1,6 +1,8 @@
#include "FvNinjaGuard.h"
#include "GameMessages.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "EntityManager.h"
void FvNinjaGuard::OnStartup(Entity* self) {
if (self->GetLOT() == 7412) {
@ -12,24 +14,24 @@ void FvNinjaGuard::OnStartup(Entity* self) {
void FvNinjaGuard::OnEmoteReceived(Entity* self, const int32_t emote, Entity* target) {
if (emote != 392) {
GameMessages::SendPlayAnimation(self, u"no");
RenderComponent::PlayAnimation(self, u"no");
return;
}
GameMessages::SendPlayAnimation(self, u"scared");
RenderComponent::PlayAnimation(self, u"scared");
if (self->GetLOT() == 7412) {
auto* rightGuard = EntityManager::Instance()->GetEntity(m_RightGuard);
if (rightGuard != nullptr) {
GameMessages::SendPlayAnimation(rightGuard, u"laugh_rt");
RenderComponent::PlayAnimation(rightGuard, u"laugh_rt");
}
} else if (self->GetLOT() == 11128) {
auto* leftGuard = EntityManager::Instance()->GetEntity(m_LeftGuard);
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 "GameMessages.h"
#include "MissionComponent.h"
#include "RenderComponent.h"
#include "eMissionState.h"
void LegoDieRoll::OnStartup(Entity* self) {
@ -17,23 +18,23 @@ void LegoDieRoll::OnTimerDone(Entity* self, std::string timerName) {
switch (dieRoll) {
case 1:
GameMessages::SendPlayAnimation(self, u"roll-die-1");
RenderComponent::PlayAnimation(self, u"roll-die-1");
break;
case 2:
GameMessages::SendPlayAnimation(self, u"roll-die-2");
RenderComponent::PlayAnimation(self, u"roll-die-2");
break;
case 3:
GameMessages::SendPlayAnimation(self, u"roll-die-3");
RenderComponent::PlayAnimation(self, u"roll-die-3");
break;
case 4:
GameMessages::SendPlayAnimation(self, u"roll-die-4");
RenderComponent::PlayAnimation(self, u"roll-die-4");
break;
case 5:
GameMessages::SendPlayAnimation(self, u"roll-die-5");
RenderComponent::PlayAnimation(self, u"roll-die-5");
break;
case 6:
{
GameMessages::SendPlayAnimation(self, u"roll-die-6");
RenderComponent::PlayAnimation(self, u"roll-die-6");
// tracking the It's Truly Random Achievement
auto* owner = self->GetOwner();
auto* missionComponent = owner->GetComponent<MissionComponent>();

View File

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

View File

@ -15,6 +15,7 @@
#include "InventoryComponent.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
#include "RenderComponent.h"
void SGCannon::OnStartup(Entity* self) {
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) {
for (auto* cannon : EntityManager::Instance()->GetEntitiesInGroup("cannongroup")) {
GameMessages::SendPlayAnimation(cannon, animationName, priority);
RenderComponent::PlayAnimation(cannon, animationName, priority);
}
if (onCannon) {
GameMessages::SendPlayAnimation(self, animationName, priority);
RenderComponent::PlayAnimation(self, animationName, priority);
}
if (onPlayer) {
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
if (player != nullptr) {
GameMessages::SendPlayAnimation(player, animationName, priority);
RenderComponent::PlayAnimation(player, animationName, priority);
}
}
}

View File

@ -9,6 +9,7 @@
#include "MissionComponent.h"
#include "eMissionState.h"
#include "eMissionTaskType.h"
#include "RenderComponent.h"
// Constants are at the bottom
@ -122,7 +123,7 @@ void NsConcertInstrument::StartPlayingInstrument(Entity* self, Entity* player) {
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendPlayCinematic(player->GetObjectID(), cinematics.at(instrumentLot), UNASSIGNED_SYSTEM_ADDRESS);
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")) {
@ -153,7 +154,7 @@ void NsConcertInstrument::StopPlayingInstrument(Entity* self, Entity* player) {
}
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,
player->GetObjectID(), "", UNASSIGNED_SYSTEM_ADDRESS);
}

View File

@ -4,6 +4,8 @@
#include "GameMessages.h"
#include "EntityManager.h"
#include "PhantomPhysicsComponent.h"
#include "RenderComponent.h"
#include "Entity.h"
void WhFans::OnStartup(Entity* self) {
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 (self->GetVar<bool>(u"on")) {
GameMessages::SendPlayAnimation(self, u"fan-off");
RenderComponent::PlayAnimation(self, u"fan-off");
renderComponent->StopEffect("fanOn");
self->SetVar<bool>(u"on", false);
@ -42,7 +44,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) {
EntityManager::Instance()->SerializeEntity(volume);
}
} 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);

View File

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