Merge branch 'main' into item-component

This commit is contained in:
Aaron Kimbre 2023-03-20 21:05:58 -05:00
commit 5e9a956bed
288 changed files with 2511 additions and 2531 deletions

View File

@ -163,6 +163,7 @@ set(INCLUDED_DIRECTORIES
"dGame/dMission" "dGame/dMission"
"dGame/dEntity" "dGame/dEntity"
"dGame/dPropertyBehaviors" "dGame/dPropertyBehaviors"
"dGame/dPropertyBehaviors/ControlBehaviorMessages"
"dGame/dUtilities" "dGame/dUtilities"
"dPhysics" "dPhysics"
"dNavigation" "dNavigation"

View File

@ -15,6 +15,7 @@
#include "dLogger.h" #include "dLogger.h"
enum eInventoryType : uint32_t; enum eInventoryType : uint32_t;
enum class eReplicaComponentType : uint32_t;
/*! /*!
\file GeneralUtils.hpp \file GeneralUtils.hpp
@ -181,6 +182,11 @@ namespace GeneralUtils {
return static_cast<eInventoryType>(std::stoul(value)); return static_cast<eInventoryType>(std::stoul(value));
} }
template <>
inline eReplicaComponentType Parse(const char* value) {
return static_cast<eReplicaComponentType>(std::stoul(value));
}
template <typename T> template <typename T>
bool TryParse(const char* value, T& dst) { bool TryParse(const char* value, T& dst) {
try { try {

View File

@ -43,8 +43,7 @@ typedef uint32_t LWOCLONEID; //!< Used for Clone IDs
typedef uint16_t LWOMAPID; //!< Used for Map IDs typedef uint16_t LWOMAPID; //!< Used for Map IDs
typedef uint16_t LWOINSTANCEID; //!< Used for Instance IDs typedef uint16_t LWOINSTANCEID; //!< Used for Instance IDs
typedef uint32_t PROPERTYCLONELIST; //!< Used for Property Clone IDs typedef uint32_t PROPERTYCLONELIST; //!< Used for Property Clone IDs
typedef uint32_t STRIPID; typedef uint32_t StripId;
typedef uint32_t BEHAVIORSTATE;
typedef int32_t PetTamingPiece; //!< Pet Taming Pieces typedef int32_t PetTamingPiece; //!< Pet Taming Pieces
@ -65,11 +64,6 @@ typedef std::set<LWOOBJID> TSetObjID;
const float PI = 3.14159f; const float PI = 3.14159f;
#if defined(__unix) || defined(__APPLE__)
//For Linux:
typedef __int64_t __int64;
#endif
//============ STRUCTS ============== //============ STRUCTS ==============
struct LWOSCENEID { struct LWOSCENEID {
@ -262,20 +256,6 @@ enum eReplicaPacketType {
PACKET_TYPE_DESTRUCTION //!< A destruction packet PACKET_TYPE_DESTRUCTION //!< A destruction packet
}; };
enum ServerDisconnectIdentifiers {
SERVER_DISCON_UNKNOWN_SERVER_ERROR = 0, //!< Unknown server error
SERVER_DISCON_DUPLICATE_LOGIN = 4, //!< Used when another user with the same username is logged in (duplicate login)
SERVER_DISCON_SERVER_SHUTDOWN = 5, //!< Used when the server is shutdown
SERVER_DISCON_SERVER_MAP_LOAD_FAILURE = 6, //!< Used when the server cannot load a map
SERVER_DISCON_INVALID_SESSION_KEY = 7, //!< Used if the session is invalid
SERVER_DISCON_ACCOUNT_NOT_IN_PENDING_LIST = 8, //!< ???
SERVER_DISCON_CHARACTER_NOT_FOUND = 9, //!< Used if a character that the server has is not found (i.e, corruption with user-player data)
SERVER_DISCON_CHARACTER_CORRUPTED = 10, //!< Similar to abovce
SERVER_DISCON_KICK = 11, //!< Used if the user is kicked from the server
SERVER_DISCON_FREE_TRIAL_EXPIRED = 12, //!< Used if the user's free trial expired
SERVER_DISCON_PLAY_SCHEDULE_TIME_DONE = 13 //!< Used if the user's play time is used up
};
//! The Behavior Types for use with the AI system //! The Behavior Types for use with the AI system
enum eCombatBehaviorTypes : uint32_t { enum eCombatBehaviorTypes : uint32_t {
PASSIVE = 0, //!< The object is passive PASSIVE = 0, //!< The object is passive
@ -380,57 +360,6 @@ enum eNotifyType {
NOTIFY_TYPE_NAMINGPET NOTIFY_TYPE_NAMINGPET
}; };
enum eReplicaComponentType : int32_t {
COMPONENT_TYPE_CONTROLLABLE_PHYSICS = 1, //!< The ControllablePhysics Component
COMPONENT_TYPE_RENDER = 2, //!< The Render Component
COMPONENT_TYPE_SIMPLE_PHYSICS = 3, //!< The SimplePhysics Component
COMPONENT_TYPE_CHARACTER = 4, //!< The Character Component
COMPONENT_TYPE_SCRIPT = 5, //!< The Script Component
COMPONENT_TYPE_BOUNCER = 6, //!< The Bouncer Component
COMPONENT_TYPE_BUFF = 7, //!< The Buff Component
COMPONENT_TYPE_SKILL = 9, //!< The Skill Component
COMPONENT_TYPE_ITEM = 11, //!< The Item Component
COMPONENT_TYPE_VENDOR = 16, //!< The Vendor Component
COMPONENT_TYPE_INVENTORY = 17, //!< The Inventory Component
COMPONENT_TYPE_SHOOTING_GALLERY = 19, //!< The Shooting Gallery Component
COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS = 20, //!< The RigidBodyPhantomPhysics Component
COMPONENT_TYPE_COLLECTIBLE = 23, //!< The Collectible Component
COMPONENT_TYPE_MOVING_PLATFORM = 25, //!< The MovingPlatform Component
COMPONENT_TYPE_PET = 26, //!< The Pet Component
COMPONENT_TYPE_VEHICLE_PHYSICS = 30, //!< The VehiclePhysics Component
COMPONENT_TYPE_MOVEMENT_AI = 31, //!< The MovementAI Component
COMPONENT_TYPE_PROPERTY = 36, //!< The Property Component
COMPONENT_TYPE_SCRIPTED_ACTIVITY = 39, //!< The ScriptedActivity Component
COMPONENT_TYPE_PHANTOM_PHYSICS = 40, //!< The PhantomPhysics Component
COMPONENT_TYPE_MODEL = 42, //!< The Model Component
COMPONENT_TYPE_PROPERTY_ENTRANCE = 43, //!< The PhantomPhysics Component
COMPONENT_TYPE_PROPERTY_MANAGEMENT = 45, //!< The PropertyManagement Component
COMPONENT_TYPE_REBUILD = 48, //!< The Rebuild Component
COMPONENT_TYPE_SWITCH = 49, //!< The Switch Component
COMPONENT_TYPE_ZONE_CONTROL = 50, //!< The ZoneControl Component
COMPONENT_TYPE_PACKAGE = 53, //!< The Package Component
COMPONENT_TYPE_PLAYER_FLAG = 58, //!< The PlayerFlag Component
COMPONENT_TYPE_BASE_COMBAT_AI = 60, //!< The BaseCombatAI Component
COMPONENT_TYPE_MODULE_ASSEMBLY = 61, //!< The ModuleAssembly Component
COMPONENT_TYPE_PROPERTY_VENDOR = 65, //!< The PropertyVendor Component
COMPONENT_TYPE_ROCKET_LAUNCH = 67, //!< The RocketLaunch Component
COMPONENT_TYPE_TRIGGER = 69,
COMPONENT_TYPE_RACING_CONTROL = 71, //!< The RacingControl Component
COMPONENT_TYPE_MISSION_OFFER = 73, //!< The MissionOffer Component
COMPONENT_TYPE_EXHIBIT = 75, //!< The Exhibit Component
COMPONENT_TYPE_RACING_STATS = 74, //!< The Racing Stats Component
COMPONENT_TYPE_SOUND_TRIGGER = 77, //!< The Sound Trigger Component
COMPONENT_TYPE_PROXIMITY_MONITOR = 78, //!< The Proximity Monitor Component
COMPONENT_TYPE_MISSION = 84, //!< The Mission Component
COMPONENT_TYPE_ROCKET_LAUNCH_LUP = 97, //!< The LUP Launchpad Componen
COMPONENT_TYPE_RAIL_ACTIVATOR = 104, //!< The Rail Activator Component
COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT = 106, //!< The Player Forced Movement Component
COMPONENT_TYPE_POSSESSABLE = 108, //!< The Possessable Component
COMPONENT_TYPE_LEVEL_PROGRESSION = 109, //!< The Level Progression Component
COMPONENT_TYPE_POSSESSOR = 110, //!< The Possessor Component
COMPONENT_TYPE_BUILD_BORDER = 114, //!< The Build Border Component
COMPONENT_TYPE_DESTROYABLE = 1000, //!< The Destroyable Component
};
enum class UseItemResponse : uint32_t { enum class UseItemResponse : uint32_t {
NoImaginationForPet = 1, NoImaginationForPet = 1,

View File

@ -546,6 +546,8 @@ enum GAME_MSG : unsigned short {
GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506, GAME_MSG_REMOVE_RUN_SPEED_MODIFIER = 1506,
GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547, GAME_MSG_UPDATE_PROPERTY_PERFORMANCE_COST = 1547,
GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553, GAME_MSG_PROPERTY_ENTRANCE_BEGIN = 1553,
GAME_MSG_SET_RESURRECT_RESTORE_VALUES = 1591,
GAME_MSG_VEHICLE_STOP_BOOST = 1617,
GAME_MSG_REMOVE_BUFF = 1648, GAME_MSG_REMOVE_BUFF = 1648,
GAME_MSG_REQUEST_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1666, GAME_MSG_REQUEST_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1666,
GAME_MSG_RESPONSE_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1667, GAME_MSG_RESPONSE_MOVE_ITEM_BETWEEN_INVENTORY_TYPES = 1667,

View File

@ -0,0 +1,127 @@
#ifndef __EREPLICACOMPONENTTYPE__H__
#define __EREPLICACOMPONENTTYPE__H__
#include <cstdint>
enum class eReplicaComponentType : uint32_t {
INVALID = 0,
CONTROLLABLE_PHYSICS,
RENDER,
SIMPLE_PHYSICS,
CHARACTER,
SCRIPT,
BOUNCER,
BUFF, // buff is really 98, this is DESTROYABLE
GHOST,
SKILL,
SPAWNER,
ITEM,
REBUILD,
REBUILD_START,
REBUILD_ACTIVATOR,
ICON_ONLY,
VENDOR,
INVENTORY,
PROJECTILE_PHYSICS,
SHOOTING_GALLERY,
RIGID_BODY_PHANTOM_PHYSICS,
DROP_EFFECT,
CHEST,
COLLECTIBLE,
BLUEPRINT,
MOVING_PLATFORM,
PET,
PLATFORM_BOUNDARY,
MODULE,
ARCADE,
VEHICLE_PHYSICS, // Havok demo based
MOVEMENT_AI,
EXHIBIT,
OVERHEAD_ICON,
PET_CONTROL,
MINIFIG,
PROPERTY,
PET_CREATOR,
MODEL_BUILDER,
SCRIPTED_ACTIVITY,
PHANTOM_PHYSICS,
SPRINGPAD,
MODEL,
PROPERTY_ENTRANCE,
FX,
PROPERTY_MANAGEMENT,
VEHICLE_PHYSICS_NEW, // internal physics based on havok
PHYSICS_SYSTEM,
QUICK_BUILD,
SWITCH,
ZONE_CONTROL, // Minigame
CHANGLING,
CHOICE_BUILD,
PACKAGE,
SOUND_REPEATER,
SOUND_AMBIENT_2D,
SOUND_AMBIENT_3D,
PRECONDITION,
PLAYER_FLAG,
CUSTOM_BUILD_ASSEMBLY,
BASE_COMBAT_AI,
MODULE_ASSEMBLY,
SHOWCASE_MODEL_HANDLER,
RACING_MODULE,
GENERIC_ACTIVATOR,
PROPERTY_VENDOR,
HF_LIGHT_DIRECTION_GADGET,
ROCKET_LAUNCH,
ROCKET_LANDING,
TRIGGER,
DROPPED_LOOT,
RACING_CONTROL,
FACTION_TRIGGER,
MISSION_OFFER,
RACING_STATS,
LUP_EXHIBIT,
BBB,
SOUND_TRIGGER,
PROXIMITY_MONITOR,
RACING_SOUND_TRIGGER,
CHAT,
FRIENDS_LIST,
GUILD,
LOCAL_SYSTEM,
MISSION,
MUTABLE_MODEL_BEHAVIORS,
PATHFINDING,
PET_TAMING_CONTROL,
PROPERTY_EDITOR,
SKINNED_RENDER,
SLASH_COMMAND,
STATUS_EFFECT,
TEAMS,
TEXT_EFFECT,
TRADE,
USER_CONTROL,
IGNORE_LIST,
ROCKET_LAUNCH_LUP,
BUFF_REAL, // the real buff component, should just be name BUFF
INTERACTION_MANAGER,
DONATION_VENDOR,
COMBAT_MEDIATOR,
COMMENDATION_VENDOR,
UNKNOWN_103,
RAIL_ACTIVATOR,
ROLLER,
PLAYER_FORCED_MOVEMENT,
CRAFTING,
POSSESSABLE,
LEVEL_PROGRESSION,
POSSESSOR,
MOUNT_CONTROL,
UNKNOWN_112,
PROPERTY_PLAQUE,
BUILD_BORDER,
UNKOWN_115,
CULLING_PLANE,
DESTROYABLE = 1000 // Actually 7
};
#endif //!__EREPLICACOMPONENTTYPE__H__

View File

@ -0,0 +1,24 @@
#ifndef __ESERVERDISCONNECTIDENTIFIERS__H__
#define __ESERVERDISCONNECTIDENTIFIERS__H__
#include <cstdint>
enum class eServerDisconnectIdentifiers : uint32_t {
UNKNOWN_SERVER_ERROR = 0,
WRONG_GAME_VERSION,
WRONG_SERVER_VERSION,
CONNECTION_ON_INVALID_PORT,
DUPLICATE_LOGIN,
SERVER_SHUTDOWN,
SERVER_MAP_LOAD_FAILURE,
INVALID_SESSION_KEY,
ACCOUNT_NOT_IN_PENDING_LIST,
CHARACTER_NOT_FOUND,
CHARACTER_CORRUPTED,
KICK,
SAVE_FAILURE,
FREE_TRIAL_EXPIRED,
PLAY_SCHEDULE_TIME_DONE
};
#endif //!__ESERVERDISCONNECTIDENTIFIERS__H__

View File

@ -1,46 +1,80 @@
#include "CDClientManager.h" #include "CDClientManager.h"
#include "CDActivityRewardsTable.h"
#include "CDAnimationsTable.h"
#include "CDBehaviorParameterTable.h"
#include "CDBehaviorTemplateTable.h"
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDDestructibleComponentTable.h"
#include "CDEmoteTable.h"
#include "CDInventoryComponentTable.h"
#include "CDItemComponentTable.h"
#include "CDItemSetsTable.h"
#include "CDItemSetSkillsTable.h"
#include "CDLevelProgressionLookupTable.h"
#include "CDLootMatrixTable.h"
#include "CDLootTableTable.h"
#include "CDMissionNPCComponentTable.h"
#include "CDMissionTasksTable.h"
#include "CDMissionsTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDPhysicsComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
#include "CDVendorComponentTable.h"
#include "CDActivitiesTable.h"
#include "CDPackageComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDBrickIDTableTable.h"
#include "CDRarityTableTable.h"
#include "CDMissionEmailTable.h"
#include "CDRewardsTable.h"
#include "CDPropertyEntranceComponentTable.h"
#include "CDPropertyTemplateTable.h"
#include "CDFeatureGatingTable.h"
#include "CDRailActivatorComponent.h"
// Static Variables CDClientManager::CDClientManager() {
CDClientManager* CDClientManager::m_Address = nullptr; CDActivityRewardsTable::Instance();
UNUSED(CDAnimationsTable::Instance());
//! Initializes the manager CDBehaviorParameterTable::Instance();
void CDClientManager::Initialize(void) { CDBehaviorTemplateTable::Instance();
tables.insert(std::make_pair("ActivityRewards", new CDActivityRewardsTable())); CDComponentsRegistryTable::Instance();
UNUSED(tables.insert(std::make_pair("Animations", new CDAnimationsTable()))); CDCurrencyTableTable::Instance();
tables.insert(std::make_pair("BehaviorParameter", new CDBehaviorParameterTable())); CDDestructibleComponentTable::Instance();
tables.insert(std::make_pair("BehaviorTemplate", new CDBehaviorTemplateTable())); CDEmoteTableTable::Instance();
tables.insert(std::make_pair("ComponentsRegistry", new CDComponentsRegistryTable())); CDInventoryComponentTable::Instance();
tables.insert(std::make_pair("CurrencyTable", new CDCurrencyTableTable())); CDItemComponentTable::Instance();
tables.insert(std::make_pair("DestructibleComponent", new CDDestructibleComponentTable())); CDItemSetsTable::Instance();
tables.insert(std::make_pair("EmoteTable", new CDEmoteTableTable())); CDItemSetSkillsTable::Instance();
tables.insert(std::make_pair("InventoryComponent", new CDInventoryComponentTable())); CDLevelProgressionLookupTable::Instance();
tables.insert(std::make_pair("ItemComponent", new CDItemComponentTable())); CDLootMatrixTable::Instance();
tables.insert(std::make_pair("ItemSets", new CDItemSetsTable())); CDLootTableTable::Instance();
tables.insert(std::make_pair("ItemSetSkills", new CDItemSetSkillsTable())); CDMissionNPCComponentTable::Instance();
tables.insert(std::make_pair("LevelProgressionLookup", new CDLevelProgressionLookupTable())); CDMissionTasksTable::Instance();
tables.insert(std::make_pair("LootMatrix", new CDLootMatrixTable())); CDMissionsTable::Instance();
tables.insert(std::make_pair("LootTable", new CDLootTableTable())); CDObjectSkillsTable::Instance();
tables.insert(std::make_pair("MissionNPCComponent", new CDMissionNPCComponentTable())); CDObjectsTable::Instance();
tables.insert(std::make_pair("MissionTasks", new CDMissionTasksTable())); CDPhysicsComponentTable::Instance();
tables.insert(std::make_pair("Missions", new CDMissionsTable())); CDRebuildComponentTable::Instance();
tables.insert(std::make_pair("ObjectSkills", new CDObjectSkillsTable())); CDScriptComponentTable::Instance();
tables.insert(std::make_pair("Objects", new CDObjectsTable())); CDSkillBehaviorTable::Instance();
tables.insert(std::make_pair("PhysicsComponent", new CDPhysicsComponentTable())); CDZoneTableTable::Instance();
tables.insert(std::make_pair("RebuildComponent", new CDRebuildComponentTable())); CDVendorComponentTable::Instance();
tables.insert(std::make_pair("ScriptComponent", new CDScriptComponentTable())); CDActivitiesTable::Instance();
tables.insert(std::make_pair("SkillBehavior", new CDSkillBehaviorTable())); CDPackageComponentTable::Instance();
tables.insert(std::make_pair("ZoneTable", new CDZoneTableTable())); CDProximityMonitorComponentTable::Instance();
tables.insert(std::make_pair("VendorComponent", new CDVendorComponentTable())); CDMovementAIComponentTable::Instance();
tables.insert(std::make_pair("Activities", new CDActivitiesTable())); CDBrickIDTableTable::Instance();
tables.insert(std::make_pair("PackageComponent", new CDPackageComponentTable())); CDRarityTableTable::Instance();
tables.insert(std::make_pair("ProximityMonitorComponent", new CDProximityMonitorComponentTable())); CDMissionEmailTable::Instance();
tables.insert(std::make_pair("MovementAIComponent", new CDMovementAIComponentTable())); CDRewardsTable::Instance();
tables.insert(std::make_pair("BrickIDTable", new CDBrickIDTableTable())); CDPropertyEntranceComponentTable::Instance();
tables.insert(std::make_pair("RarityTable", new CDRarityTableTable())); CDPropertyTemplateTable::Instance();
tables.insert(std::make_pair("MissionEmail", new CDMissionEmailTable())); CDFeatureGatingTable::Instance();
tables.insert(std::make_pair("Rewards", new CDRewardsTable())); CDRailActivatorComponentTable::Instance();
tables.insert(std::make_pair("PropertyEntranceComponent", new CDPropertyEntranceComponentTable()));
tables.insert(std::make_pair("PropertyTemplate", new CDPropertyTemplateTable()));
tables.insert(std::make_pair("FeatureGating", new CDFeatureGatingTable()));
tables.insert(std::make_pair("RailActivatorComponent", new CDRailActivatorComponentTable()));
} }

View File

@ -1,96 +1,24 @@
#pragma once #pragma once
// Custom Classes
#include "CDTable.h" #include "CDTable.h"
// Tables #include "Singleton.h"
#include "CDActivityRewardsTable.h"
#include "CDAnimationsTable.h"
#include "CDBehaviorParameterTable.h"
#include "CDBehaviorTemplateTable.h"
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDDestructibleComponentTable.h"
#include "CDEmoteTable.h"
#include "CDInventoryComponentTable.h"
#include "CDItemComponentTable.h"
#include "CDItemSetsTable.h"
#include "CDItemSetSkillsTable.h"
#include "CDLevelProgressionLookupTable.h"
#include "CDLootMatrixTable.h"
#include "CDLootTableTable.h"
#include "CDMissionNPCComponentTable.h"
#include "CDMissionTasksTable.h"
#include "CDMissionsTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDPhysicsComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
#include "CDVendorComponentTable.h"
#include "CDActivitiesTable.h"
#include "CDPackageComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDBrickIDTableTable.h"
#include "CDRarityTableTable.h"
#include "CDMissionEmailTable.h"
#include "CDRewardsTable.h"
#include "CDPropertyEntranceComponentTable.h"
#include "CDPropertyTemplateTable.h"
#include "CDFeatureGatingTable.h"
#include "CDRailActivatorComponent.h"
// C++ /**
#include <type_traits> * Initialize the CDClient tables so they are all loaded into memory.
#include <unordered_map>
/*!
\file CDClientManager.hpp
\brief A manager for the CDClient tables
*/ */
class CDClientManager : public Singleton<CDClientManager> {
//! Manages all data from the CDClient
class CDClientManager {
private:
static CDClientManager* m_Address; //!< The singleton address
std::unordered_map<std::string, CDTable*> tables; //!< The tables
public: public:
CDClientManager();
//! The singleton method /**
static CDClientManager* Instance() { * Fetch a table from CDClient
if (m_Address == 0) { *
m_Address = new CDClientManager; * @tparam Table type to fetch
} * @return A pointer to the requested table.
return m_Address;
}
//! Initializes the manager
void Initialize(void);
//! Fetches a CDClient table
/*!
This function uses typename T which must be a subclass of CDTable.
It returns the class that conforms to the class name
\param tableName The table name
\return The class or nullptr
*/ */
template<typename T> template<typename T>
T* GetTable(const std::string& tableName) { T* GetTable() {
static_assert(std::is_base_of<CDTable, T>::value, "T should inherit from CDTable!"); return &T::Instance();
for (auto itr = this->tables.begin(); itr != this->tables.end(); ++itr) {
if (itr->first == tableName) {
return dynamic_cast<T*>(itr->second);
}
}
return nullptr;
} }
}; };

View File

@ -1,6 +1,5 @@
#include "CDActivitiesTable.h" #include "CDActivitiesTable.h"
//! Constructor
CDActivitiesTable::CDActivitiesTable(void) { CDActivitiesTable::CDActivitiesTable(void) {
// First, get the size of the table // First, get the size of the table
@ -48,15 +47,6 @@ CDActivitiesTable::CDActivitiesTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDActivitiesTable::~CDActivitiesTable(void) {}
//! Returns the table's name
std::string CDActivitiesTable::GetName(void) const {
return "Activities";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) { std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActivities)> predicate) {
std::vector<CDActivities> data = cpplinq::from(this->entries) std::vector<CDActivities> data = cpplinq::from(this->entries)
@ -66,7 +56,6 @@ std::vector<CDActivities> CDActivitiesTable::Query(std::function<bool(CDActiviti
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const { std::vector<CDActivities> CDActivitiesTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDActivitiesTable.hpp
\brief Contains data for the Activities table
*/
//! Activities Entry Struct
struct CDActivities { struct CDActivities {
unsigned int ActivityID; unsigned int ActivityID;
unsigned int locStatus; unsigned int locStatus;
@ -31,36 +25,14 @@ struct CDActivities {
float optionalPercentage; float optionalPercentage;
}; };
class CDActivitiesTable : public CDTable<CDActivitiesTable> {
//! Activities table
class CDActivitiesTable : public CDTable {
private: private:
std::vector<CDActivities> entries; std::vector<CDActivities> entries;
public: public:
CDActivitiesTable();
//! Constructor // Queries the table with a custom "where" clause
CDActivitiesTable(void);
//! Destructor
~CDActivitiesTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate); std::vector<CDActivities> Query(std::function<bool(CDActivities)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivities> GetEntries(void) const; std::vector<CDActivities> GetEntries(void) const;
}; };

View File

@ -1,6 +1,5 @@
#include "CDActivityRewardsTable.h" #include "CDActivityRewardsTable.h"
//! Constructor
CDActivityRewardsTable::CDActivityRewardsTable(void) { CDActivityRewardsTable::CDActivityRewardsTable(void) {
// First, get the size of the table // First, get the size of the table
@ -36,15 +35,6 @@ CDActivityRewardsTable::CDActivityRewardsTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDActivityRewardsTable::~CDActivityRewardsTable(void) {}
//! Returns the table's name
std::string CDActivityRewardsTable::GetName(void) const {
return "ActivityRewards";
}
//! Queries the table with a custom "where" clause
std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) { std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(CDActivityRewards)> predicate) {
std::vector<CDActivityRewards> data = cpplinq::from(this->entries) std::vector<CDActivityRewards> data = cpplinq::from(this->entries)
@ -54,7 +44,6 @@ std::vector<CDActivityRewards> CDActivityRewardsTable::Query(std::function<bool(
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const { std::vector<CDActivityRewards> CDActivityRewardsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDActivityRewardsTable.hpp
\brief Contains data for the ActivityRewards table
*/
//! ActivityRewards Entry Struct
struct CDActivityRewards { struct CDActivityRewards {
unsigned int objectTemplate; //!< The object template (?) unsigned int objectTemplate; //!< The object template (?)
unsigned int ActivityRewardIndex; //!< The activity reward index unsigned int ActivityRewardIndex; //!< The activity reward index
@ -19,36 +13,15 @@ struct CDActivityRewards {
std::string description; //!< The description std::string description; //!< The description
}; };
class CDActivityRewardsTable : public CDTable<CDActivityRewardsTable> {
//! ActivityRewards table
class CDActivityRewardsTable : public CDTable {
private: private:
std::vector<CDActivityRewards> entries; std::vector<CDActivityRewards> entries;
public: public:
CDActivityRewardsTable();
//! Constructor // Queries the table with a custom "where" clause
CDActivityRewardsTable(void);
//! Destructor
~CDActivityRewardsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate); std::vector<CDActivityRewards> Query(std::function<bool(CDActivityRewards)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDActivityRewards> GetEntries(void) const; std::vector<CDActivityRewards> GetEntries(void) const;
}; };

View File

@ -1,6 +1,5 @@
#include "CDAnimationsTable.h" #include "CDAnimationsTable.h"
//! Constructor
CDAnimationsTable::CDAnimationsTable(void) { CDAnimationsTable::CDAnimationsTable(void) {
// First, get the size of the table // First, get the size of the table
@ -42,15 +41,6 @@ CDAnimationsTable::CDAnimationsTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDAnimationsTable::~CDAnimationsTable(void) {}
//! Returns the table's name
std::string CDAnimationsTable::GetName(void) const {
return "Animations";
}
//! Queries the table with a custom "where" clause
std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) { std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimations)> predicate) {
std::vector<CDAnimations> data = cpplinq::from(this->entries) std::vector<CDAnimations> data = cpplinq::from(this->entries)
@ -60,7 +50,6 @@ std::vector<CDAnimations> CDAnimationsTable::Query(std::function<bool(CDAnimatio
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const { std::vector<CDAnimations> CDAnimationsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDAnimationsTable.hpp
\brief Contains data for the Animations table
*/
//! Animations Entry Struct
struct CDAnimations { struct CDAnimations {
unsigned int animationGroupID; //!< The animation group ID unsigned int animationGroupID; //!< The animation group ID
std::string animation_type; //!< The animation type std::string animation_type; //!< The animation type
@ -26,35 +20,14 @@ struct CDAnimations {
}; };
//! Animations table class CDAnimationsTable : public CDTable<CDAnimationsTable> {
class CDAnimationsTable : public CDTable {
private: private:
std::vector<CDAnimations> entries; std::vector<CDAnimations> entries;
public: public:
CDAnimationsTable();
//! Constructor // Queries the table with a custom "where" clause
CDAnimationsTable(void);
//! Destructor
~CDAnimationsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate); std::vector<CDAnimations> Query(std::function<bool(CDAnimations)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDAnimations> GetEntries(void) const; std::vector<CDAnimations> GetEntries(void) const;
}; };

View File

@ -1,7 +1,6 @@
#include "CDBehaviorParameterTable.h" #include "CDBehaviorParameterTable.h"
#include "GeneralUtils.h" #include "GeneralUtils.h"
//! Constructor
CDBehaviorParameterTable::CDBehaviorParameterTable(void) { CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter"); auto tableData = CDClientDatabase::ExecuteQuery("SELECT * FROM BehaviorParameter");
uint32_t uniqueParameterId = 0; uint32_t uniqueParameterId = 0;
@ -28,14 +27,6 @@ CDBehaviorParameterTable::CDBehaviorParameterTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDBehaviorParameterTable::~CDBehaviorParameterTable(void) {}
//! Returns the table's name
std::string CDBehaviorParameterTable::GetName(void) const {
return "BehaviorParameter";
}
float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) { float CDBehaviorParameterTable::GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue) {
auto parameterID = this->m_ParametersList.find(name); auto parameterID = this->m_ParametersList.find(name);
if (parameterID == this->m_ParametersList.end()) return defaultValue; if (parameterID == this->m_ParametersList.end()) return defaultValue;

View File

@ -5,37 +5,18 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
/*!
\file CDBehaviorParameterTable.hpp
\brief Contains data for the BehaviorParameter table
*/
//! BehaviorParameter Entry Struct
struct CDBehaviorParameter { struct CDBehaviorParameter {
unsigned int behaviorID; //!< The Behavior ID unsigned int behaviorID; //!< The Behavior ID
std::unordered_map<std::string, uint32_t>::iterator parameterID; //!< The Parameter ID std::unordered_map<std::string, uint32_t>::iterator parameterID; //!< The Parameter ID
float value; //!< The value of the behavior template float value; //!< The value of the behavior template
}; };
//! BehaviorParameter table class CDBehaviorParameterTable : public CDTable<CDBehaviorParameterTable> {
class CDBehaviorParameterTable : public CDTable {
private: private:
std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries; std::unordered_map<uint64_t, CDBehaviorParameter> m_Entries;
std::unordered_map<std::string, uint32_t> m_ParametersList; std::unordered_map<std::string, uint32_t> m_ParametersList;
public: public:
CDBehaviorParameterTable();
//! Constructor
CDBehaviorParameterTable(void);
//! Destructor
~CDBehaviorParameterTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0); float GetValue(const uint32_t behaviorID, const std::string& name, const float defaultValue = 0);
std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID); std::map<std::string, float> GetParametersByBehaviorID(uint32_t behaviorID);

View File

@ -1,6 +1,5 @@
#include "CDBehaviorTemplateTable.h" #include "CDBehaviorTemplateTable.h"
//! Constructor
CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) { CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
// First, get the size of the table // First, get the size of the table
@ -40,15 +39,6 @@ CDBehaviorTemplateTable::CDBehaviorTemplateTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDBehaviorTemplateTable::~CDBehaviorTemplateTable(void) {}
//! Returns the table's name
std::string CDBehaviorTemplateTable::GetName(void) const {
return "BehaviorTemplate";
}
//! Queries the table with a custom "where" clause
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) { std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<bool(CDBehaviorTemplate)> predicate) {
std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries) std::vector<CDBehaviorTemplate> data = cpplinq::from(this->entries)
@ -58,7 +48,6 @@ std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::Query(std::function<boo
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const { std::vector<CDBehaviorTemplate> CDBehaviorTemplateTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -5,12 +5,6 @@
#include <unordered_map> #include <unordered_map>
#include <unordered_set> #include <unordered_set>
/*!
\file CDBehaviorTemplateTable.hpp
\brief Contains data for the BehaviorTemplate table
*/
//! BehaviorTemplate Entry Struct
struct CDBehaviorTemplate { struct CDBehaviorTemplate {
unsigned int behaviorID; //!< The Behavior ID unsigned int behaviorID; //!< The Behavior ID
unsigned int templateID; //!< The Template ID (LOT) unsigned int templateID; //!< The Template ID (LOT)
@ -19,36 +13,16 @@ struct CDBehaviorTemplate {
}; };
//! BehaviorTemplate table class CDBehaviorTemplateTable : public CDTable<CDBehaviorTemplateTable> {
class CDBehaviorTemplateTable : public CDTable {
private: private:
std::vector<CDBehaviorTemplate> entries; std::vector<CDBehaviorTemplate> entries;
std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID; std::unordered_map<uint32_t, CDBehaviorTemplate> entriesMappedByBehaviorID;
std::unordered_set<std::string> m_EffectHandles; std::unordered_set<std::string> m_EffectHandles;
public: public:
CDBehaviorTemplateTable();
//! Constructor // Queries the table with a custom "where" clause
CDBehaviorTemplateTable(void);
//! Destructor
~CDBehaviorTemplateTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate); std::vector<CDBehaviorTemplate> Query(std::function<bool(CDBehaviorTemplate)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBehaviorTemplate> GetEntries(void) const; std::vector<CDBehaviorTemplate> GetEntries(void) const;
const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID); const CDBehaviorTemplate GetByBehaviorID(uint32_t behaviorID);

View File

@ -1,6 +1,5 @@
#include "CDBrickIDTableTable.h" #include "CDBrickIDTableTable.h"
//! Constructor
CDBrickIDTableTable::CDBrickIDTableTable(void) { CDBrickIDTableTable::CDBrickIDTableTable(void) {
// First, get the size of the table // First, get the size of the table
@ -31,15 +30,6 @@ CDBrickIDTableTable::CDBrickIDTableTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDBrickIDTableTable::~CDBrickIDTableTable(void) {}
//! Returns the table's name
std::string CDBrickIDTableTable::GetName(void) const {
return "BrickIDTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) { std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBrickIDTable)> predicate) {
std::vector<CDBrickIDTable> data = cpplinq::from(this->entries) std::vector<CDBrickIDTable> data = cpplinq::from(this->entries)
@ -49,7 +39,6 @@ std::vector<CDBrickIDTable> CDBrickIDTableTable::Query(std::function<bool(CDBric
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const { std::vector<CDBrickIDTable> CDBrickIDTableTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -16,34 +16,14 @@ struct CDBrickIDTable {
//! BrickIDTable table //! BrickIDTable table
class CDBrickIDTableTable : public CDTable { class CDBrickIDTableTable : public CDTable<CDBrickIDTableTable> {
private: private:
std::vector<CDBrickIDTable> entries; std::vector<CDBrickIDTable> entries;
public: public:
CDBrickIDTableTable();
//! Constructor // Queries the table with a custom "where" clause
CDBrickIDTableTable(void);
//! Destructor
~CDBrickIDTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate); std::vector<CDBrickIDTable> Query(std::function<bool(CDBrickIDTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDBrickIDTable> GetEntries(void) const; std::vector<CDBrickIDTable> GetEntries(void) const;
}; };

View File

@ -1,8 +1,8 @@
#include "CDComponentsRegistryTable.h" #include "CDComponentsRegistryTable.h"
#include "eReplicaComponentType.h"
#define CDCLIENT_CACHE_ALL #define CDCLIENT_CACHE_ALL
//! Constructor
CDComponentsRegistryTable::CDComponentsRegistryTable(void) { CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#ifdef CDCLIENT_CACHE_ALL #ifdef CDCLIENT_CACHE_ALL
@ -25,29 +25,11 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
while (!tableData.eof()) { while (!tableData.eof()) {
CDComponentsRegistry entry; CDComponentsRegistry entry;
entry.id = tableData.getIntField("id", -1); entry.id = tableData.getIntField("id", -1);
entry.component_type = tableData.getIntField("component_type", -1); entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
entry.component_id = tableData.getIntField("component_id", -1); 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); this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
//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.nextRow();
} }
@ -55,15 +37,7 @@ CDComponentsRegistryTable::CDComponentsRegistryTable(void) {
#endif #endif
} }
//! Destructor int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
CDComponentsRegistryTable::~CDComponentsRegistryTable(void) {}
//! Returns the table's name
std::string CDComponentsRegistryTable::GetName(void) const {
return "ComponentsRegistry";
}
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue) {
const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id)); const auto& iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
if (iter == this->mappedEntries.end()) { if (iter == this->mappedEntries.end()) {
@ -72,16 +46,6 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, uint32_t componen
return iter->second; return iter->second;
/*
const auto& it = this->mappedEntries.find(id);
if (it != mappedEntries.end()) {
const auto& iter = it->second.find(componentType);
if (iter != it->second.end()) {
return iter->second;
}
}
*/
#ifndef CDCLIENT_CACHE_ALL #ifndef CDCLIENT_CACHE_ALL
// Now get the data // Now get the data
std::stringstream query; std::stringstream query;

View File

@ -3,38 +3,19 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*! enum class eReplicaComponentType : uint32_t;
\file CDComponentsRegistryTable.hpp
\brief Contains data for the ComponentsRegistry table
*/
//! ComponentsRegistry Entry Struct
struct CDComponentsRegistry { struct CDComponentsRegistry {
unsigned int id; //!< The LOT is used as the ID unsigned int id; //!< The LOT is used as the ID
unsigned int component_type; //!< See ComponentTypes enum for values 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 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
}; };
//! ComponentsRegistry table class CDComponentsRegistryTable : public CDTable<CDComponentsRegistryTable> {
class CDComponentsRegistryTable : public CDTable {
private: private:
//std::vector<CDComponentsRegistry> entries;
std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id std::map<uint64_t, uint32_t> mappedEntries; //id, component_type, component_id
public: public:
CDComponentsRegistryTable();
//! Constructor int32_t GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue = 0);
CDComponentsRegistryTable(void);
//! Destructor
~CDComponentsRegistryTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
int32_t GetByIDAndType(uint32_t id, uint32_t componentType, int32_t defaultValue = 0);
}; };

View File

@ -34,15 +34,6 @@ CDCurrencyTableTable::CDCurrencyTableTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDCurrencyTableTable::~CDCurrencyTableTable(void) {}
//! Returns the table's name
std::string CDCurrencyTableTable::GetName(void) const {
return "CurrencyTable";
}
//! Queries the table with a custom "where" clause
std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) { std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCurrencyTable)> predicate) {
std::vector<CDCurrencyTable> data = cpplinq::from(this->entries) std::vector<CDCurrencyTable> data = cpplinq::from(this->entries)
@ -52,7 +43,6 @@ std::vector<CDCurrencyTable> CDCurrencyTableTable::Query(std::function<bool(CDCu
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const { std::vector<CDCurrencyTable> CDCurrencyTableTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -18,34 +18,14 @@ struct CDCurrencyTable {
}; };
//! CurrencyTable table //! CurrencyTable table
class CDCurrencyTableTable : public CDTable { class CDCurrencyTableTable : public CDTable<CDCurrencyTableTable> {
private: private:
std::vector<CDCurrencyTable> entries; std::vector<CDCurrencyTable> entries;
public: public:
CDCurrencyTableTable();
//! Constructor // Queries the table with a custom "where" clause
CDCurrencyTableTable(void);
//! Destructor
~CDCurrencyTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate); std::vector<CDCurrencyTable> Query(std::function<bool(CDCurrencyTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDCurrencyTable> GetEntries(void) const; std::vector<CDCurrencyTable> GetEntries(void) const;
}; };

View File

@ -43,15 +43,6 @@ CDDestructibleComponentTable::CDDestructibleComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDDestructibleComponentTable::~CDDestructibleComponentTable(void) {}
//! Returns the table's name
std::string CDDestructibleComponentTable::GetName(void) const {
return "DestructibleComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) { std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::function<bool(CDDestructibleComponent)> predicate) {
std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries) std::vector<CDDestructibleComponent> data = cpplinq::from(this->entries)
@ -61,7 +52,6 @@ std::vector<CDDestructibleComponent> CDDestructibleComponentTable::Query(std::fu
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const { std::vector<CDDestructibleComponent> CDDestructibleComponentTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDDestructibleComponentTable.hpp
\brief Contains data for the DestructibleComponent table
*/
//! ItemComponent Struct
struct CDDestructibleComponent { struct CDDestructibleComponent {
unsigned int id; //!< The component ID from the ComponentsRegistry Table unsigned int id; //!< The component ID from the ComponentsRegistry Table
int faction; //!< The Faction ID of the object int faction; //!< The Faction ID of the object
@ -26,35 +20,14 @@ struct CDDestructibleComponent {
int difficultyLevel; //!< ??? int difficultyLevel; //!< ???
}; };
//! ItemComponent table class CDDestructibleComponentTable : public CDTable<CDDestructibleComponentTable> {
class CDDestructibleComponentTable : public CDTable {
private: private:
std::vector<CDDestructibleComponent> entries; std::vector<CDDestructibleComponent> entries;
public: public:
CDDestructibleComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDDestructibleComponentTable(void);
//! Destructor
~CDDestructibleComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate); std::vector<CDDestructibleComponent> Query(std::function<bool(CDDestructibleComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDDestructibleComponent> GetEntries(void) const; std::vector<CDDestructibleComponent> GetEntries(void) const;
}; };

View File

@ -30,11 +30,6 @@ CDEmoteTableTable::~CDEmoteTableTable(void) {
entries.clear(); entries.clear();
} }
//! Returns the table's name
std::string CDEmoteTableTable::GetName(void) const {
return "Emotes";
}
CDEmoteTable* CDEmoteTableTable::GetEmote(int id) { CDEmoteTable* CDEmoteTableTable::GetEmote(int id) {
for (auto e : entries) { for (auto e : entries) {
if (e.first == id) return e.second; if (e.first == id) return e.second;

View File

@ -4,12 +4,6 @@
#include "CDTable.h" #include "CDTable.h"
#include <map> #include <map>
/*!
\file CDEmoteTable.hpp
\brief Contains data for the CDEmoteTable table
*/
//! CDEmoteEntry Struct
struct CDEmoteTable { struct CDEmoteTable {
CDEmoteTable() { CDEmoteTable() {
ID = -1; ID = -1;
@ -32,25 +26,13 @@ struct CDEmoteTable {
std::string gateVersion; std::string gateVersion;
}; };
//! CDEmoteTable table class CDEmoteTableTable : public CDTable<CDEmoteTableTable> {
class CDEmoteTableTable : public CDTable {
private: private:
std::map<int, CDEmoteTable*> entries; std::map<int, CDEmoteTable*> entries;
public: public:
CDEmoteTableTable();
//! Constructor ~CDEmoteTableTable();
CDEmoteTableTable(void); // Returns an emote by ID
//! Destructor
~CDEmoteTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Returns an emote by ID
CDEmoteTable* GetEmote(int id); CDEmoteTable* GetEmote(int id);
}; };

View File

@ -34,15 +34,6 @@ CDFeatureGatingTable::CDFeatureGatingTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDFeatureGatingTable::~CDFeatureGatingTable(void) {}
//! Returns the table's name
std::string CDFeatureGatingTable::GetName(void) const {
return "FeatureGating";
}
//! Queries the table with a custom "where" clause
std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) { std::vector<CDFeatureGating> CDFeatureGatingTable::Query(std::function<bool(CDFeatureGating)> predicate) {
std::vector<CDFeatureGating> data = cpplinq::from(this->entries) std::vector<CDFeatureGating> data = cpplinq::from(this->entries)
@ -62,7 +53,6 @@ bool CDFeatureGatingTable::FeatureUnlocked(const std::string& feature) const {
return false; return false;
} }
//! Gets all the entries in the table
std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const { std::vector<CDFeatureGating> CDFeatureGatingTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,11 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDFeatureGatingTable.hpp
*/
//! ItemComponent Struct
struct CDFeatureGating { struct CDFeatureGating {
std::string featureName; std::string featureName;
int32_t major; int32_t major;
@ -16,37 +11,16 @@ struct CDFeatureGating {
std::string description; std::string description;
}; };
//! ItemComponent table class CDFeatureGatingTable : public CDTable<CDFeatureGatingTable> {
class CDFeatureGatingTable : public CDTable {
private: private:
std::vector<CDFeatureGating> entries; std::vector<CDFeatureGating> entries;
public: public:
CDFeatureGatingTable();
//! Constructor // Queries the table with a custom "where" clause
CDFeatureGatingTable(void);
//! Destructor
~CDFeatureGatingTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate); std::vector<CDFeatureGating> Query(std::function<bool(CDFeatureGating)> predicate);
bool FeatureUnlocked(const std::string& feature) const; bool FeatureUnlocked(const std::string& feature) const;
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDFeatureGating> GetEntries(void) const; std::vector<CDFeatureGating> GetEntries(void) const;
}; };

View File

@ -33,15 +33,6 @@ CDInventoryComponentTable::CDInventoryComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDInventoryComponentTable::~CDInventoryComponentTable(void) {}
//! Returns the table's name
std::string CDInventoryComponentTable::GetName(void) const {
return "InventoryComponent";
}
//! Queries the table with a custom "where" clause
std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) { std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function<bool(CDInventoryComponent)> predicate) {
std::vector<CDInventoryComponent> data = cpplinq::from(this->entries) std::vector<CDInventoryComponent> data = cpplinq::from(this->entries)
@ -51,7 +42,6 @@ std::vector<CDInventoryComponent> CDInventoryComponentTable::Query(std::function
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const { std::vector<CDInventoryComponent> CDInventoryComponentTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDInventoryComponentTable.hpp
\brief Contains data for the InventoryComponent table
*/
//! ItemComponent Struct
struct CDInventoryComponent { struct CDInventoryComponent {
unsigned int id; //!< The component ID for this object unsigned int id; //!< The component ID for this object
unsigned int itemid; //!< The LOT of the object unsigned int itemid; //!< The LOT of the object
@ -16,35 +10,14 @@ struct CDInventoryComponent {
bool equip; //!< Whether or not to equip the item bool equip; //!< Whether or not to equip the item
}; };
//! ItemComponent table class CDInventoryComponentTable : public CDTable<CDInventoryComponentTable> {
class CDInventoryComponentTable : public CDTable {
private: private:
std::vector<CDInventoryComponent> entries; std::vector<CDInventoryComponent> entries;
public: public:
CDInventoryComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDInventoryComponentTable(void);
//! Destructor
~CDInventoryComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate); std::vector<CDInventoryComponent> Query(std::function<bool(CDInventoryComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDInventoryComponent> GetEntries(void) const; std::vector<CDInventoryComponent> GetEntries(void) const;
}; };

View File

@ -74,14 +74,6 @@ CDItemComponentTable::CDItemComponentTable(void) {
#endif #endif
} }
//! Destructor
CDItemComponentTable::~CDItemComponentTable(void) {}
//! Returns the table's name
std::string CDItemComponentTable::GetName(void) const {
return "ItemComponent";
}
const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) { const CDItemComponent& CDItemComponentTable::GetItemComponentByID(unsigned int skillID) {
const auto& it = this->entries.find(skillID); const auto& it = this->entries.find(skillID);
if (it != this->entries.end()) { if (it != this->entries.end()) {

View File

@ -4,12 +4,6 @@
#include "CDTable.h" #include "CDTable.h"
#include "dCommonVars.h" #include "dCommonVars.h"
/*!
\file CDItemComponentTable.hpp
\brief Contains data for the ItemComponent table
*/
//! ItemComponent Struct
struct CDItemComponent { struct CDItemComponent {
unsigned int id; //!< The Component ID unsigned int id; //!< The Component ID
std::string equipLocation; //!< The equip location std::string equipLocation; //!< The equip location
@ -55,28 +49,15 @@ struct CDItemComponent {
float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced) float SellMultiplier; //!< Something to do with early vendors perhaps (but replaced)
}; };
//! ItemComponent table class CDItemComponentTable : public CDTable<CDItemComponentTable> {
class CDItemComponentTable : public CDTable {
private: private:
std::map<unsigned int, CDItemComponent> entries; std::map<unsigned int, CDItemComponent> entries;
public: public:
CDItemComponentTable();
//! Constructor
CDItemComponentTable(void);
//! Destructor
~CDItemComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent); static std::map<LOT, uint32_t> ParseCraftingCurrencies(const CDItemComponent& itemComponent);
//! Gets an entry by ID // Gets an entry by ID
const CDItemComponent& GetItemComponentByID(unsigned int skillID); const CDItemComponent& GetItemComponentByID(unsigned int skillID);
static CDItemComponent Default; static CDItemComponent Default;

View File

@ -32,15 +32,6 @@ CDItemSetSkillsTable::CDItemSetSkillsTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDItemSetSkillsTable::~CDItemSetSkillsTable(void) {}
//! Returns the table's name
std::string CDItemSetSkillsTable::GetName(void) const {
return "ItemSetSkills";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) { std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDItemSetSkills)> predicate) {
std::vector<CDItemSetSkills> data = cpplinq::from(this->entries) std::vector<CDItemSetSkills> data = cpplinq::from(this->entries)
@ -50,7 +41,6 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::Query(std::function<bool(CDIt
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const { std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }
@ -65,4 +55,3 @@ std::vector<CDItemSetSkills> CDItemSetSkillsTable::GetBySkillID(unsigned int Ski
return toReturn; return toReturn;
} }

View File

@ -3,50 +3,22 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDItemSetSkillsTable.hpp
\brief Contains data for the ItemSetSkills table
*/
//! ZoneTable Struct
struct CDItemSetSkills { struct CDItemSetSkills {
unsigned int SkillSetID; //!< The skill set ID unsigned int SkillSetID; //!< The skill set ID
unsigned int SkillID; //!< The skill ID unsigned int SkillID; //!< The skill ID
unsigned int SkillCastType; //!< The skill cast type unsigned int SkillCastType; //!< The skill cast type
}; };
//! ItemSets table class CDItemSetSkillsTable : public CDTable<CDItemSetSkillsTable> {
class CDItemSetSkillsTable : public CDTable {
private: private:
std::vector<CDItemSetSkills> entries; std::vector<CDItemSetSkills> entries;
public: public:
CDItemSetSkillsTable();
//! Constructor // Queries the table with a custom "where" clause
CDItemSetSkillsTable(void);
//! Destructor
~CDItemSetSkillsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate); std::vector<CDItemSetSkills> Query(std::function<bool(CDItemSetSkills)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSetSkills> GetEntries(void) const; std::vector<CDItemSetSkills> GetEntries(void) const;
std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID); std::vector<CDItemSetSkills> GetBySkillID(unsigned int SkillSetID);
}; };

View File

@ -44,15 +44,6 @@ CDItemSetsTable::CDItemSetsTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDItemSetsTable::~CDItemSetsTable(void) {}
//! Returns the table's name
std::string CDItemSetsTable::GetName(void) const {
return "ItemSets";
}
//! Queries the table with a custom "where" clause
std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) { std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> predicate) {
std::vector<CDItemSets> data = cpplinq::from(this->entries) std::vector<CDItemSets> data = cpplinq::from(this->entries)
@ -62,7 +53,6 @@ std::vector<CDItemSets> CDItemSetsTable::Query(std::function<bool(CDItemSets)> p
return data; return data;
} }
//! Gets all the entries in the table
std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const { std::vector<CDItemSets> CDItemSetsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDItemSetsTable.hpp
\brief Contains data for the ItemSets table
*/
//! ZoneTable Struct
struct CDItemSets { struct CDItemSets {
unsigned int setID; //!< The item set ID unsigned int setID; //!< The item set ID
unsigned int locStatus; //!< The loc status unsigned int locStatus; //!< The loc status
@ -27,36 +21,15 @@ struct CDItemSets {
float priority; //!< The priority float priority; //!< The priority
}; };
//! ItemSets table class CDItemSetsTable : public CDTable<CDItemSetsTable> {
class CDItemSetsTable : public CDTable {
private: private:
std::vector<CDItemSets> entries; std::vector<CDItemSets> entries;
public: public:
CDItemSetsTable();
//! Constructor // Queries the table with a custom "where" clause
CDItemSetsTable(void);
//! Destructor
~CDItemSetsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate); std::vector<CDItemSets> Query(std::function<bool(CDItemSets)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDItemSets> GetEntries(void) const; std::vector<CDItemSets> GetEntries(void) const;
}; };

View File

@ -32,14 +32,6 @@ CDLevelProgressionLookupTable::CDLevelProgressionLookupTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDLevelProgressionLookupTable::~CDLevelProgressionLookupTable(void) {}
//! Returns the table's name
std::string CDLevelProgressionLookupTable::GetName(void) const {
return "LevelProgressionLookup";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) { std::vector<CDLevelProgressionLookup> CDLevelProgressionLookupTable::Query(std::function<bool(CDLevelProgressionLookup)> predicate) {

View File

@ -3,47 +3,21 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDLevelProgressionLookupTable.hpp
\brief Contains data for the LevelProgressionLookup table
*/
//! LevelProgressionLookup Entry Struct
struct CDLevelProgressionLookup { struct CDLevelProgressionLookup {
unsigned int id; //!< The Level ID unsigned int id; //!< The Level ID
unsigned int requiredUScore; //!< The required LEGO Score unsigned int requiredUScore; //!< The required LEGO Score
std::string BehaviorEffect; //!< The behavior effect attached to this std::string BehaviorEffect; //!< The behavior effect attached to this
}; };
//! LevelProgressionLookup table class CDLevelProgressionLookupTable : public CDTable<CDLevelProgressionLookupTable> {
class CDLevelProgressionLookupTable : public CDTable {
private: private:
std::vector<CDLevelProgressionLookup> entries; std::vector<CDLevelProgressionLookup> entries;
public: public:
CDLevelProgressionLookupTable();
//! Constructor // Queries the table with a custom "where" clause
CDLevelProgressionLookupTable(void);
//! Destructor
~CDLevelProgressionLookupTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate); std::vector<CDLevelProgressionLookup> Query(std::function<bool(CDLevelProgressionLookup)> predicate);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDLevelProgressionLookup> GetEntries(void) const; std::vector<CDLevelProgressionLookup> GetEntries(void) const;
}; };

View File

@ -38,15 +38,6 @@ CDLootMatrixTable::CDLootMatrixTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDLootMatrixTable::~CDLootMatrixTable(void) {}
//! Returns the table's name
std::string CDLootMatrixTable::GetName(void) const {
return "LootMatrix";
}
//! Queries the table with a custom "where" clause
std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatrix)> predicate) { std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatrix)> predicate) {
std::vector<CDLootMatrix> data = cpplinq::from(this->entries) std::vector<CDLootMatrix> data = cpplinq::from(this->entries)
@ -56,7 +47,6 @@ std::vector<CDLootMatrix> CDLootMatrixTable::Query(std::function<bool(CDLootMatr
return data; return data;
} }
//! Gets all the entries in the table
const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const { const std::vector<CDLootMatrix>& CDLootMatrixTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDLootMatrixTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! LootMatrix Struct
struct CDLootMatrix { struct CDLootMatrix {
unsigned int LootMatrixIndex; //!< The Loot Matrix Index unsigned int LootMatrixIndex; //!< The Loot Matrix Index
unsigned int LootTableIndex; //!< The Loot Table Index unsigned int LootTableIndex; //!< The Loot Table Index
@ -21,36 +15,15 @@ struct CDLootMatrix {
UNUSED(std::string gate_version); //!< The Gate Version UNUSED(std::string gate_version); //!< The Gate Version
}; };
//! MissionNPCComponent table class CDLootMatrixTable : public CDTable<CDLootMatrixTable> {
class CDLootMatrixTable : public CDTable {
private: private:
std::vector<CDLootMatrix> entries; std::vector<CDLootMatrix> entries;
public: public:
CDLootMatrixTable();
//! Constructor // Queries the table with a custom "where" clause
CDLootMatrixTable(void);
//! Destructor
~CDLootMatrixTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate); std::vector<CDLootMatrix> Query(std::function<bool(CDLootMatrix)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootMatrix>& GetEntries(void) const; const std::vector<CDLootMatrix>& GetEntries(void) const;
}; };

View File

@ -35,14 +35,6 @@ CDLootTableTable::CDLootTableTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDLootTableTable::~CDLootTableTable(void) {}
//! Returns the table's name
std::string CDLootTableTable::GetName(void) const {
return "LootTable";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) { std::vector<CDLootTable> CDLootTableTable::Query(std::function<bool(CDLootTable)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDLootTableTable.hpp
\brief Contains data for the LootTable table
*/
//! LootTable Struct
struct CDLootTable { struct CDLootTable {
unsigned int itemid; //!< The LOT of the item unsigned int itemid; //!< The LOT of the item
unsigned int LootTableIndex; //!< The Loot Table Index unsigned int LootTableIndex; //!< The Loot Table Index
@ -17,36 +11,15 @@ struct CDLootTable {
unsigned int sortPriority; //!< The sorting priority unsigned int sortPriority; //!< The sorting priority
}; };
//! LootTable table class CDLootTableTable : public CDTable<CDLootTableTable> {
class CDLootTableTable : public CDTable {
private: private:
std::vector<CDLootTable> entries; std::vector<CDLootTable> entries;
public: public:
CDLootTableTable();
//! Constructor // Queries the table with a custom "where" clause
CDLootTableTable(void);
//! Destructor
~CDLootTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate); std::vector<CDLootTable> Query(std::function<bool(CDLootTable)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDLootTable>& GetEntries(void) const; const std::vector<CDLootTable>& GetEntries(void) const;
}; };

View File

@ -37,14 +37,6 @@ CDMissionEmailTable::CDMissionEmailTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDMissionEmailTable::~CDMissionEmailTable(void) {}
//! Returns the table's name
std::string CDMissionEmailTable::GetName(void) const {
return "MissionEmail";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) { std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMissionEmail)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDMissionEmailTable.hpp
\brief Contains data for the MissionEmail table
*/
//! MissionEmail Entry Struct
struct CDMissionEmail { struct CDMissionEmail {
unsigned int ID; unsigned int ID;
unsigned int messageType; unsigned int messageType;
@ -21,35 +15,14 @@ struct CDMissionEmail {
}; };
//! MissionEmail table class CDMissionEmailTable : public CDTable<CDMissionEmailTable> {
class CDMissionEmailTable : public CDTable {
private: private:
std::vector<CDMissionEmail> entries; std::vector<CDMissionEmail> entries;
public: public:
CDMissionEmailTable();
//! Constructor // Queries the table with a custom "where" clause
CDMissionEmailTable(void);
//! Destructor
~CDMissionEmailTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate); std::vector<CDMissionEmail> Query(std::function<bool(CDMissionEmail)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMissionEmail> GetEntries(void) const; std::vector<CDMissionEmail> GetEntries(void) const;
}; };

View File

@ -34,14 +34,6 @@ CDMissionNPCComponentTable::CDMissionNPCComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDMissionNPCComponentTable::~CDMissionNPCComponentTable(void) {}
//! Returns the table's name
std::string CDMissionNPCComponentTable::GetName(void) const {
return "MissionNPCComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) { std::vector<CDMissionNPCComponent> CDMissionNPCComponentTable::Query(std::function<bool(CDMissionNPCComponent)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDMissionNPCComponentTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! MissionNPCComponent Struct
struct CDMissionNPCComponent { struct CDMissionNPCComponent {
unsigned int id; //!< The ID unsigned int id; //!< The ID
unsigned int missionID; //!< The Mission ID unsigned int missionID; //!< The Mission ID
@ -17,35 +11,16 @@ struct CDMissionNPCComponent {
std::string gate_version; //!< The gate version std::string gate_version; //!< The gate version
}; };
//! MissionNPCComponent table class CDMissionNPCComponentTable : public CDTable<CDMissionNPCComponentTable> {
class CDMissionNPCComponentTable : public CDTable {
private: private:
std::vector<CDMissionNPCComponent> entries; std::vector<CDMissionNPCComponent> entries;
public: public:
CDMissionNPCComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDMissionNPCComponentTable(void);
//! Destructor
~CDMissionNPCComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate); std::vector<CDMissionNPCComponent> Query(std::function<bool(CDMissionNPCComponent)> predicate);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMissionNPCComponent> GetEntries(void) const; std::vector<CDMissionNPCComponent> GetEntries(void) const;
}; };

View File

@ -42,15 +42,6 @@ CDMissionTasksTable::CDMissionTasksTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDMissionTasksTable::~CDMissionTasksTable(void) {}
//! Returns the table's name
std::string CDMissionTasksTable::GetName(void) const {
return "MissionTasks";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) { std::vector<CDMissionTasks> CDMissionTasksTable::Query(std::function<bool(CDMissionTasks)> predicate) {
std::vector<CDMissionTasks> data = cpplinq::from(this->entries) std::vector<CDMissionTasks> data = cpplinq::from(this->entries)
@ -74,7 +65,6 @@ std::vector<CDMissionTasks*> CDMissionTasksTable::GetByMissionID(uint32_t missio
return tasks; return tasks;
} }
//! Gets all the entries in the table
const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const { const std::vector<CDMissionTasks>& CDMissionTasksTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDMissionTasksTable.hpp
\brief Contains data for the MissionTasks table
*/
//! ObjectSkills Struct
struct CDMissionTasks { struct CDMissionTasks {
unsigned int id; //!< The Mission ID that the task belongs to unsigned int id; //!< The Mission ID that the task belongs to
UNUSED(unsigned int locStatus); //!< ??? UNUSED(unsigned int locStatus); //!< ???
@ -25,37 +19,17 @@ struct CDMissionTasks {
UNUSED(std::string gate_version); //!< ??? UNUSED(std::string gate_version); //!< ???
}; };
//! ObjectSkills table class CDMissionTasksTable : public CDTable<CDMissionTasksTable> {
class CDMissionTasksTable : public CDTable {
private: private:
std::vector<CDMissionTasks> entries; std::vector<CDMissionTasks> entries;
public: public:
CDMissionTasksTable();
//! Constructor // Queries the table with a custom "where" clause
CDMissionTasksTable(void);
//! Destructor
~CDMissionTasksTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate); std::vector<CDMissionTasks> Query(std::function<bool(CDMissionTasks)> predicate);
std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID); std::vector<CDMissionTasks*> GetByMissionID(uint32_t missionID);
//! Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDMissionTasks>& GetEntries(void) const; const std::vector<CDMissionTasks>& GetEntries(void) const;
}; };

View File

@ -85,15 +85,6 @@ CDMissionsTable::CDMissionsTable(void) {
Default.id = -1; Default.id = -1;
} }
//! Destructor
CDMissionsTable::~CDMissionsTable(void) {}
//! Returns the table's name
std::string CDMissionsTable::GetName(void) const {
return "Missions";
}
//! Queries the table with a custom "where" clause
std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) { std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> predicate) {
std::vector<CDMissions> data = cpplinq::from(this->entries) std::vector<CDMissions> data = cpplinq::from(this->entries)
@ -103,7 +94,6 @@ std::vector<CDMissions> CDMissionsTable::Query(std::function<bool(CDMissions)> p
return data; return data;
} }
//! Gets all the entries in the table
const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const { const std::vector<CDMissions>& CDMissionsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -5,12 +5,6 @@
#include <map> #include <map>
#include <cstdint> #include <cstdint>
/*!
\file CDMissionsTable.hpp
\brief Contains data for the Missions table
*/
//! Missions Struct
struct CDMissions { struct CDMissions {
int id; //!< The Mission ID int id; //!< The Mission ID
std::string defined_type; //!< The type of mission std::string defined_type; //!< The type of mission
@ -66,35 +60,16 @@ struct CDMissions {
int reward_bankinventory; //!< The amount of bank space this mission rewards int reward_bankinventory; //!< The amount of bank space this mission rewards
}; };
//! Missions table class CDMissionsTable : public CDTable<CDMissionsTable> {
class CDMissionsTable : public CDTable {
private: private:
std::vector<CDMissions> entries; std::vector<CDMissions> entries;
public: public:
CDMissionsTable();
//! Constructor // Queries the table with a custom "where" clause
CDMissionsTable(void);
//! Destructor
~CDMissionsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate); std::vector<CDMissions> Query(std::function<bool(CDMissions)> predicate);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
const std::vector<CDMissions>& GetEntries(void) const; const std::vector<CDMissions>& GetEntries(void) const;
const CDMissions* GetPtrByMissionID(uint32_t missionID) const; const CDMissions* GetPtrByMissionID(uint32_t missionID) const;

View File

@ -37,14 +37,6 @@ CDMovementAIComponentTable::CDMovementAIComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDMovementAIComponentTable::~CDMovementAIComponentTable(void) {}
//! Returns the table's name
std::string CDMovementAIComponentTable::GetName(void) const {
return "MovementAIComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::function<bool(CDMovementAIComponent)> predicate) { std::vector<CDMovementAIComponent> CDMovementAIComponentTable::Query(std::function<bool(CDMovementAIComponent)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDMovementAIComponentTable.hpp
\brief Contains data for the MovementAIComponent table
*/
//! MovementAIComponent Struct
struct CDMovementAIComponent { struct CDMovementAIComponent {
unsigned int id; unsigned int id;
std::string MovementType; std::string MovementType;
@ -20,36 +14,15 @@ struct CDMovementAIComponent {
std::string attachedPath; std::string attachedPath;
}; };
//! MovementAIComponent table class CDMovementAIComponentTable : public CDTable<CDMovementAIComponentTable> {
class CDMovementAIComponentTable : public CDTable {
private: private:
std::vector<CDMovementAIComponent> entries; std::vector<CDMovementAIComponent> entries;
public: public:
CDMovementAIComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDMovementAIComponentTable(void);
//! Destructor
~CDMovementAIComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate); std::vector<CDMovementAIComponent> Query(std::function<bool(CDMovementAIComponent)> predicate);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDMovementAIComponent> GetEntries(void) const; std::vector<CDMovementAIComponent> GetEntries(void) const;
}; };

View File

@ -33,14 +33,6 @@ CDObjectSkillsTable::CDObjectSkillsTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDObjectSkillsTable::~CDObjectSkillsTable(void) {}
//! Returns the table's name
std::string CDObjectSkillsTable::GetName(void) const {
return "ObjectSkills";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) { std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObjectSkills)> predicate) {
@ -55,4 +47,3 @@ std::vector<CDObjectSkills> CDObjectSkillsTable::Query(std::function<bool(CDObje
std::vector<CDObjectSkills> CDObjectSkillsTable::GetEntries(void) const { std::vector<CDObjectSkills> CDObjectSkillsTable::GetEntries(void) const {
return this->entries; return this->entries;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDObjectSkillsTable.hpp
\brief Contains data for the ObjectSkills table
*/
//! ObjectSkills Struct
struct CDObjectSkills { struct CDObjectSkills {
unsigned int objectTemplate; //!< The LOT of the item unsigned int objectTemplate; //!< The LOT of the item
unsigned int skillID; //!< The Skill ID of the object unsigned int skillID; //!< The Skill ID of the object
@ -16,35 +10,16 @@ struct CDObjectSkills {
unsigned int AICombatWeight; //!< ??? unsigned int AICombatWeight; //!< ???
}; };
//! ObjectSkills table class CDObjectSkillsTable : public CDTable<CDObjectSkillsTable> {
class CDObjectSkillsTable : public CDTable {
private: private:
std::vector<CDObjectSkills> entries; std::vector<CDObjectSkills> entries;
public: public:
CDObjectSkillsTable();
//! Constructor // Queries the table with a custom "where" clause
CDObjectSkillsTable(void);
//! Destructor
~CDObjectSkillsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate); std::vector<CDObjectSkills> Query(std::function<bool(CDObjectSkills)> predicate);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDObjectSkills> GetEntries(void) const; std::vector<CDObjectSkills> GetEntries(void) const;
}; };

View File

@ -43,14 +43,6 @@ CDObjectsTable::CDObjectsTable(void) {
m_default.id = 0; m_default.id = 0;
} }
//! Destructor
CDObjectsTable::~CDObjectsTable(void) {}
//! Returns the table's name
std::string CDObjectsTable::GetName(void) const {
return "Objects";
}
const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) { const CDObjects& CDObjectsTable::GetByID(unsigned int LOT) {
const auto& it = this->entries.find(LOT); const auto& it = this->entries.find(LOT);
if (it != this->entries.end()) { if (it != this->entries.end()) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDObjectsTable.hpp
\brief Contains data for the Objects table
*/
//! RebuildComponent Struct
struct CDObjects { struct CDObjects {
unsigned int id; //!< The LOT of the object unsigned int id; //!< The LOT of the object
std::string name; //!< The internal name of the object std::string name; //!< The internal name of the object
@ -26,29 +20,14 @@ struct CDObjects {
UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com UNUSED(unsigned int HQ_valid); //!< Probably used for the Nexus HQ database on LEGOUniverse.com
}; };
//! ObjectSkills table class CDObjectsTable : public CDTable<CDObjectsTable> {
class CDObjectsTable : public CDTable {
private: private:
//std::vector<CDObjects> entries;
std::map<unsigned int, CDObjects> entries; std::map<unsigned int, CDObjects> entries;
CDObjects m_default; CDObjects m_default;
public: public:
CDObjectsTable();
//! Constructor // Gets an entry by ID
CDObjectsTable(void);
//! Destructor
~CDObjectsTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Gets an entry by ID
const CDObjects& GetByID(unsigned int LOT); const CDObjects& GetByID(unsigned int LOT);
}; };

View File

@ -32,14 +32,6 @@ CDPackageComponentTable::CDPackageComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDPackageComponentTable::~CDPackageComponentTable(void) {}
//! Returns the table's name
std::string CDPackageComponentTable::GetName(void) const {
return "PackageComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) { std::vector<CDPackageComponent> CDPackageComponentTable::Query(std::function<bool(CDPackageComponent)> predicate) {

View File

@ -3,48 +3,20 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDPackageComponentTable.hpp
\brief Contains data for the PackageComponent table
*/
//! PackageComponent Entry Struct
struct CDPackageComponent { struct CDPackageComponent {
unsigned int id; unsigned int id;
unsigned int LootMatrixIndex; unsigned int LootMatrixIndex;
unsigned int packageType; unsigned int packageType;
}; };
class CDPackageComponentTable : public CDTable<CDPackageComponentTable> {
//! PackageComponent table
class CDPackageComponentTable : public CDTable {
private: private:
std::vector<CDPackageComponent> entries; std::vector<CDPackageComponent> entries;
public: public:
//! Constructor
CDPackageComponentTable(void); CDPackageComponentTable(void);
// Queries the table with a custom "where" clause
//! Destructor
~CDPackageComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate); std::vector<CDPackageComponent> Query(std::function<bool(CDPackageComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDPackageComponent> GetEntries(void) const; std::vector<CDPackageComponent> GetEntries(void) const;
}; };

View File

@ -28,7 +28,7 @@ CDPhysicsComponentTable::CDPhysicsComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
CDPhysicsComponentTable::~CDPhysicsComponentTable(void) { CDPhysicsComponentTable::~CDPhysicsComponentTable() {
for (auto e : m_entries) { for (auto e : m_entries) {
if (e.second) delete e.second; if (e.second) delete e.second;
} }
@ -36,10 +36,6 @@ CDPhysicsComponentTable::~CDPhysicsComponentTable(void) {
m_entries.clear(); m_entries.clear();
} }
std::string CDPhysicsComponentTable::GetName(void) const {
return "PhysicsComponent";
}
CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) { CDPhysicsComponent* CDPhysicsComponentTable::GetByID(unsigned int componentID) {
for (auto e : m_entries) { for (auto e : m_entries) {
if (e.first == componentID) return e.second; if (e.first == componentID) return e.second;

View File

@ -21,12 +21,12 @@ struct CDPhysicsComponent {
UNUSED(std::string gravityVolumeAsset); UNUSED(std::string gravityVolumeAsset);
}; };
class CDPhysicsComponentTable : public CDTable { class CDPhysicsComponentTable : public CDTable<CDPhysicsComponentTable> {
public: public:
CDPhysicsComponentTable(void); CDPhysicsComponentTable();
~CDPhysicsComponentTable(void); ~CDPhysicsComponentTable();
std::string GetName(void) const override; static const std::string GetTableName() { return "PhysicsComponent"; };
CDPhysicsComponent* GetByID(unsigned int componentID); CDPhysicsComponent* GetByID(unsigned int componentID);
private: private:

View File

@ -32,12 +32,6 @@ CDPropertyEntranceComponentTable::CDPropertyEntranceComponentTable() {
tableData.finalize(); tableData.finalize();
} }
CDPropertyEntranceComponentTable::~CDPropertyEntranceComponentTable(void) = default;
std::string CDPropertyEntranceComponentTable::GetName() const {
return "PropertyEntranceComponent";
}
CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) { CDPropertyEntranceComponent CDPropertyEntranceComponentTable::GetByID(uint32_t id) {
for (const auto& entry : entries) { for (const auto& entry : entries) {
if (entry.id == id) if (entry.id == id)

View File

@ -9,31 +9,13 @@ struct CDPropertyEntranceComponent {
std::string groupType; std::string groupType;
}; };
class CDPropertyEntranceComponentTable : public CDTable { class CDPropertyEntranceComponentTable : public CDTable<CDPropertyEntranceComponentTable> {
public: public:
//! Constructor
CDPropertyEntranceComponentTable(); CDPropertyEntranceComponentTable();
// Queries the table with a custom "where" clause
//! Destructor
~CDPropertyEntranceComponentTable();
//! Returns the table's name
/*!
\return The table name
*/
[[nodiscard]] std::string GetName() const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
CDPropertyEntranceComponent GetByID(uint32_t id); CDPropertyEntranceComponent GetByID(uint32_t id);
//! Gets all the entries in the table // Gets all the entries in the table
/*!
\return The entries
*/
[[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; } [[nodiscard]] std::vector<CDPropertyEntranceComponent> GetEntries() const { return entries; }
private: private:
std::vector<CDPropertyEntranceComponent> entries{}; std::vector<CDPropertyEntranceComponent> entries{};

View File

@ -30,12 +30,6 @@ CDPropertyTemplateTable::CDPropertyTemplateTable() {
tableData.finalize(); tableData.finalize();
} }
CDPropertyTemplateTable::~CDPropertyTemplateTable() = default;
std::string CDPropertyTemplateTable::GetName() const {
return "PropertyTemplate";
}
CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) { CDPropertyTemplate CDPropertyTemplateTable::GetByMapID(uint32_t mapID) {
for (const auto& entry : entries) { for (const auto& entry : entries) {
if (entry.mapID == mapID) if (entry.mapID == mapID)

View File

@ -8,12 +8,11 @@ struct CDPropertyTemplate {
std::string spawnName; std::string spawnName;
}; };
class CDPropertyTemplateTable : public CDTable { class CDPropertyTemplateTable : public CDTable<CDPropertyTemplateTable> {
public: public:
CDPropertyTemplateTable(); CDPropertyTemplateTable();
~CDPropertyTemplateTable();
[[nodiscard]] std::string GetName() const override; static const std::string GetTableName() { return "PropertyTemplate"; };
CDPropertyTemplate GetByMapID(uint32_t mapID); CDPropertyTemplate GetByMapID(uint32_t mapID);
private: private:
std::vector<CDPropertyTemplate> entries{}; std::vector<CDPropertyTemplate> entries{};

View File

@ -33,14 +33,6 @@ CDProximityMonitorComponentTable::CDProximityMonitorComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDProximityMonitorComponentTable::~CDProximityMonitorComponentTable(void) {}
//! Returns the table's name
std::string CDProximityMonitorComponentTable::GetName(void) const {
return "ProximityMonitorComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query(std::function<bool(CDProximityMonitorComponent)> predicate) { std::vector<CDProximityMonitorComponent> CDProximityMonitorComponentTable::Query(std::function<bool(CDProximityMonitorComponent)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDProximityMonitorComponentTable.hpp
\brief Contains data for the ProximityMonitorComponent table
*/
//! ProximityMonitorComponent Entry Struct
struct CDProximityMonitorComponent { struct CDProximityMonitorComponent {
unsigned int id; unsigned int id;
std::string Proximities; std::string Proximities;
@ -16,36 +10,14 @@ struct CDProximityMonitorComponent {
bool LoadOnServer; bool LoadOnServer;
}; };
class CDProximityMonitorComponentTable : public CDTable<CDProximityMonitorComponentTable> {
//! ProximityMonitorComponent table
class CDProximityMonitorComponentTable : public CDTable {
private: private:
std::vector<CDProximityMonitorComponent> entries; std::vector<CDProximityMonitorComponent> entries;
public: public:
//! Constructor
CDProximityMonitorComponentTable(void); CDProximityMonitorComponentTable(void);
//! Destructor
~CDProximityMonitorComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate); std::vector<CDProximityMonitorComponent> Query(std::function<bool(CDProximityMonitorComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDProximityMonitorComponent> GetEntries(void) const; std::vector<CDProximityMonitorComponent> GetEntries(void) const;
}; };

View File

@ -43,12 +43,6 @@ CDRailActivatorComponentTable::CDRailActivatorComponentTable() {
tableData.finalize(); tableData.finalize();
} }
CDRailActivatorComponentTable::~CDRailActivatorComponentTable() = default;
std::string CDRailActivatorComponentTable::GetName() const {
return "RailActivatorComponent";
}
CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const { CDRailActivatorComponent CDRailActivatorComponentTable::GetEntryByID(int32_t id) const {
for (const auto& entry : m_Entries) { for (const auto& entry : m_Entries) {
if (entry.id == id) if (entry.id == id)

View File

@ -20,12 +20,10 @@ struct CDRailActivatorComponent {
bool showNameBillboard; bool showNameBillboard;
}; };
class CDRailActivatorComponentTable : public CDTable { class CDRailActivatorComponentTable : public CDTable<CDRailActivatorComponentTable> {
public: public:
CDRailActivatorComponentTable(); CDRailActivatorComponentTable();
~CDRailActivatorComponentTable(); static const std::string GetTableName() { return "RailActivatorComponent"; };
std::string GetName() const override;
[[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const; [[nodiscard]] CDRailActivatorComponent GetEntryByID(int32_t id) const;
[[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const; [[nodiscard]] std::vector<CDRailActivatorComponent> GetEntries() const;
private: private:

View File

@ -33,14 +33,6 @@ CDRarityTableTable::CDRarityTableTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDRarityTableTable::~CDRarityTableTable(void) {}
//! Returns the table's name
std::string CDRarityTableTable::GetName(void) const {
return "RarityTable";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarityTable)> predicate) { std::vector<CDRarityTable> CDRarityTableTable::Query(std::function<bool(CDRarityTable)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDRarityTableTable.hpp
\brief Contains data for the RarityTable table
*/
//! RarityTable Entry Struct
struct CDRarityTable { struct CDRarityTable {
unsigned int id; unsigned int id;
float randmax; float randmax;
@ -32,37 +26,15 @@ struct CDRarityTable {
} }
}; };
class CDRarityTableTable : public CDTable<CDRarityTableTable> {
//! RarityTable table
class CDRarityTableTable : public CDTable {
private: private:
std::vector<CDRarityTable> entries; std::vector<CDRarityTable> entries;
public: public:
CDRarityTableTable();
//! Constructor // Queries the table with a custom "where" clause
CDRarityTableTable(void);
//! Destructor
~CDRarityTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate); std::vector<CDRarityTable> Query(std::function<bool(CDRarityTable)> predicate);
//! Gets all the entries in the table const std::vector<CDRarityTable>& GetEntries() const;
/*!
\return The entries
*/
const std::vector<CDRarityTable>& GetEntries(void) const;
}; };

View File

@ -39,14 +39,6 @@ CDRebuildComponentTable::CDRebuildComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDRebuildComponentTable::~CDRebuildComponentTable(void) {}
//! Returns the table's name
std::string CDRebuildComponentTable::GetName(void) const {
return "RebuildComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) { std::vector<CDRebuildComponent> CDRebuildComponentTable::Query(std::function<bool(CDRebuildComponent)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDRebuildComponentTable.hpp
\brief Contains data for the RebuildComponent table
*/
//! RebuildComponent Struct
struct CDRebuildComponent { struct CDRebuildComponent {
unsigned int id; //!< The component Id unsigned int id; //!< The component Id
float reset_time; //!< The reset time float reset_time; //!< The reset time
@ -22,36 +16,15 @@ struct CDRebuildComponent {
float time_before_smash; //!< The time before smash float time_before_smash; //!< The time before smash
}; };
//! ObjectSkills table class CDRebuildComponentTable : public CDTable<CDRebuildComponentTable> {
class CDRebuildComponentTable : public CDTable {
private: private:
std::vector<CDRebuildComponent> entries; std::vector<CDRebuildComponent> entries;
public: public:
CDRebuildComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDRebuildComponentTable(void);
//! Destructor
~CDRebuildComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate); std::vector<CDRebuildComponent> Query(std::function<bool(CDRebuildComponent)> predicate);
//! Gets all the entries in the table std::vector<CDRebuildComponent> GetEntries() const;
/*!
\return The entries
*/
std::vector<CDRebuildComponent> GetEntries(void) const;
}; };

View File

@ -26,10 +26,6 @@ CDRewardsTable::~CDRewardsTable(void) {
m_entries.clear(); m_entries.clear();
} }
std::string CDRewardsTable::GetName(void) const {
return "Rewards";
}
std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) { std::vector<CDRewards*> CDRewardsTable::GetByLevelID(uint32_t levelID) {
std::vector<CDRewards*> result{}; std::vector<CDRewards*> result{};
for (const auto& e : m_entries) { for (const auto& e : m_entries) {

View File

@ -11,12 +11,12 @@ struct CDRewards {
int32_t count; int32_t count;
}; };
class CDRewardsTable : public CDTable { class CDRewardsTable : public CDTable<CDRewardsTable> {
public: public:
CDRewardsTable(void); CDRewardsTable();
~CDRewardsTable(void); ~CDRewardsTable();
std::string GetName(void) const override; static const std::string GetTableName() { return "Rewards"; };
std::vector<CDRewards*> GetByLevelID(uint32_t levelID); std::vector<CDRewards*> GetByLevelID(uint32_t levelID);
private: private:

View File

@ -29,14 +29,6 @@ CDScriptComponentTable::CDScriptComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDScriptComponentTable::~CDScriptComponentTable(void) {}
//! Returns the table's name
std::string CDScriptComponentTable::GetName(void) const {
return "ScriptComponent";
}
const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) { const CDScriptComponent& CDScriptComponentTable::GetByID(unsigned int id) {
std::map<unsigned int, CDScriptComponent>::iterator it = this->entries.find(id); std::map<unsigned int, CDScriptComponent>::iterator it = this->entries.find(id);
if (it != this->entries.end()) { if (it != this->entries.end()) {

View File

@ -3,44 +3,20 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDScriptComponentTable.hpp
\brief Contains data for the ScriptComponent table
*/
//! ScriptComponent Struct
struct CDScriptComponent { struct CDScriptComponent {
unsigned int id; //!< The component ID unsigned int id; //!< The component ID
std::string script_name; //!< The script name std::string script_name; //!< The script name
std::string client_script_name; //!< The client script name std::string client_script_name; //!< The client script name
}; };
//! ObjectSkills table class CDScriptComponentTable : public CDTable<CDScriptComponentTable> {
class CDScriptComponentTable : public CDTable {
private: private:
std::map<unsigned int, CDScriptComponent> entries; std::map<unsigned int, CDScriptComponent> entries;
CDScriptComponent m_ToReturnWhenNoneFound; CDScriptComponent m_ToReturnWhenNoneFound;
public: public:
//! Gets an entry by ID CDScriptComponentTable();
// Gets an entry by scriptID
const CDScriptComponent& GetByID(unsigned int id); const CDScriptComponent& GetByID(unsigned int id);
//! Constructor
CDScriptComponentTable(void);
//! Destructor
~CDScriptComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
}; };

View File

@ -51,24 +51,8 @@ CDSkillBehaviorTable::CDSkillBehaviorTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDSkillBehaviorTable::~CDSkillBehaviorTable(void) {}
//! Returns the table's name
std::string CDSkillBehaviorTable::GetName(void) const {
return "SkillBehavior";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDSkillBehavior> CDSkillBehaviorTable::Query(std::function<bool(CDSkillBehavior)> predicate) { std::vector<CDSkillBehavior> CDSkillBehaviorTable::Query(std::function<bool(CDSkillBehavior)> predicate) {
/*std::vector<CDSkillBehavior> data = cpplinq::from(this->entries)
>> cpplinq::where(predicate)
>> cpplinq::to_vector();
return data;*/
//Logger::LogDebug("CDSkillBehaviorTable", "The 'Query' function is no longer working! Please use GetSkillByID instead!");
std::vector<CDSkillBehavior> data; //So MSVC shuts up std::vector<CDSkillBehavior> data; //So MSVC shuts up
return data; return data;
} }

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDSkillBehaviorTable.hpp
\brief Contains data for the SkillBehavior table
*/
//! ZoneTable Struct
struct CDSkillBehavior { struct CDSkillBehavior {
unsigned int skillID; //!< The Skill ID of the skill unsigned int skillID; //!< The Skill ID of the skill
UNUSED(unsigned int locStatus); //!< ?? UNUSED(unsigned int locStatus); //!< ??
@ -31,33 +25,17 @@ struct CDSkillBehavior {
UNUSED(unsigned int cancelType); //!< The cancel type (?) UNUSED(unsigned int cancelType); //!< The cancel type (?)
}; };
//! SkillBehavior table class CDSkillBehaviorTable : public CDTable<CDSkillBehaviorTable> {
class CDSkillBehaviorTable : public CDTable {
private: private:
std::map<unsigned int, CDSkillBehavior> entries; std::map<unsigned int, CDSkillBehavior> entries;
CDSkillBehavior m_empty; CDSkillBehavior m_empty;
public: public:
CDSkillBehaviorTable();
//! Constructor // Queries the table with a custom "where" clause
CDSkillBehaviorTable(void);
//! Destructor
~CDSkillBehaviorTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate); std::vector<CDSkillBehavior> Query(std::function<bool(CDSkillBehavior)> predicate);
//! Gets an entry by ID // Gets an entry by skillID
const CDSkillBehavior& GetSkillByID(unsigned int skillID); const CDSkillBehavior& GetSkillByID(unsigned int skillID);
}; };

View File

@ -1,9 +1,8 @@
#pragma once #pragma once
// Custom Classes #include "CDClientDatabase.h"
#include "../CDClientDatabase.h" #include "Singleton.h"
// C++
#include <functional> #include <functional>
#include <string> #include <string>
#include <vector> #include <vector>
@ -19,23 +18,8 @@
#pragma warning (disable : 4244) //Disable double to float conversion warnings #pragma warning (disable : 4244) //Disable double to float conversion warnings
#pragma warning (disable : 4715) //Disable "not all control paths return a value" #pragma warning (disable : 4715) //Disable "not all control paths return a value"
#if defined(__unix) || defined(__APPLE__) template<class Table>
//For Linux: class CDTable : public Singleton<Table> {
typedef __int64_t __int64; protected:
#endif virtual ~CDTable() = default;
/*!
\file CDTable.hpp
\brief A virtual class for CDClient Tables
*/
//! The base class for all CD tables
class CDTable {
public:
//! Returns the table's name
/*!
\return The table name
*/
virtual std::string GetName() const = 0;
}; };

View File

@ -34,14 +34,6 @@ CDVendorComponentTable::CDVendorComponentTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDVendorComponentTable::~CDVendorComponentTable(void) {}
//! Returns the table's name
std::string CDVendorComponentTable::GetName(void) const {
return "VendorComponent";
}
//! Queries the table with a custom "where" clause //! Queries the table with a custom "where" clause
std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) { std::vector<CDVendorComponent> CDVendorComponentTable::Query(std::function<bool(CDVendorComponent)> predicate) {

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDVendorComponentTable.hpp
\brief Contains data for the VendorComponent table
*/
//! VendorComponent Struct
struct CDVendorComponent { struct CDVendorComponent {
unsigned int id; //!< The Component ID unsigned int id; //!< The Component ID
float buyScalar; //!< Buy Scalar (what does that mean?) float buyScalar; //!< Buy Scalar (what does that mean?)
@ -17,36 +11,15 @@ struct CDVendorComponent {
unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items unsigned int LootMatrixIndex; //!< LootMatrixIndex of the vendor's items
}; };
//! VendorComponent table class CDVendorComponentTable : public CDTable<CDVendorComponentTable> {
class CDVendorComponentTable : public CDTable {
private: private:
std::vector<CDVendorComponent> entries; std::vector<CDVendorComponent> entries;
public: public:
CDVendorComponentTable();
//! Constructor // Queries the table with a custom "where" clause
CDVendorComponentTable(void);
//! Destructor
~CDVendorComponentTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a custom "where" clause
/*!
\param predicate The predicate
*/
std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate); std::vector<CDVendorComponent> Query(std::function<bool(CDVendorComponent)> predicate);
//! Gets all the entries in the table
/*!
\return The entries
*/
std::vector<CDVendorComponent> GetEntries(void) const; std::vector<CDVendorComponent> GetEntries(void) const;
}; };

View File

@ -53,14 +53,6 @@ CDZoneTableTable::CDZoneTableTable(void) {
tableData.finalize(); tableData.finalize();
} }
//! Destructor
CDZoneTableTable::~CDZoneTableTable(void) {}
//! Returns the table's name
std::string CDZoneTableTable::GetName(void) const {
return "ZoneTable";
}
//! Queries the table with a zoneID to find. //! Queries the table with a zoneID to find.
const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) { const CDZoneTable* CDZoneTableTable::Query(unsigned int zoneID) {
const auto& iter = m_Entries.find(zoneID); const auto& iter = m_Entries.find(zoneID);

View File

@ -3,12 +3,6 @@
// Custom Classes // Custom Classes
#include "CDTable.h" #include "CDTable.h"
/*!
\file CDZoneTableTable.hpp
\brief Contains data for the ZoneTable table
*/
//! ZoneTable Struct
struct CDZoneTable { struct CDZoneTable {
unsigned int zoneID; //!< The Zone ID of the object unsigned int zoneID; //!< The Zone ID of the object
unsigned int locStatus; //!< The Locale Status(?) unsigned int locStatus; //!< The Locale Status(?)
@ -39,28 +33,13 @@ struct CDZoneTable {
UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed UNUSED(bool mountsAllowed); //!< Whether or not mounts are allowed
}; };
//! ZoneTable table class CDZoneTableTable : public CDTable<CDZoneTableTable> {
class CDZoneTableTable : public CDTable {
private: private:
std::map<unsigned int, CDZoneTable> m_Entries; std::map<unsigned int, CDZoneTable> m_Entries;
public: public:
CDZoneTableTable();
//! Constructor // Queries the table with a zoneID to find.
CDZoneTableTable(void);
//! Destructor
~CDZoneTableTable(void);
//! Returns the table's name
/*!
\return The table name
*/
std::string GetName(void) const override;
//! Queries the table with a zoneID to find.
/*!
\param id The zoneID
*/
const CDZoneTable* Query(unsigned int zoneID); const CDZoneTable* Query(unsigned int zoneID);
}; };

View File

@ -72,6 +72,19 @@
#include "TriggerComponent.h" #include "TriggerComponent.h"
#include "ItemComponent.h" #include "ItemComponent.h"
#include "MutableModelBehaviorComponent.h" #include "MutableModelBehaviorComponent.h"
#include "eReplicaComponentType.h"
// Table includes
#include "CDComponentsRegistryTable.h"
#include "CDCurrencyTableTable.h"
#include "CDMovementAIComponentTable.h"
#include "CDProximityMonitorComponentTable.h"
#include "CDRebuildComponentTable.h"
#include "CDObjectSkillsTable.h"
#include "CDObjectsTable.h"
#include "CDScriptComponentTable.h"
#include "CDSkillBehaviorTable.h"
#include "CDZoneTableTable.h"
Entity::Entity(const LWOOBJID& objectID, EntityInfo info, Entity* parentEntity) { Entity::Entity(const LWOOBJID& objectID, EntityInfo info, Entity* parentEntity) {
m_ObjectID = objectID; m_ObjectID = objectID;
@ -137,7 +150,7 @@ void Entity::Initialize() {
const auto triggerInfo = GetVarAsString(u"trigger_id"); const auto triggerInfo = GetVarAsString(u"trigger_id");
if (!triggerInfo.empty()) m_Components.emplace(COMPONENT_TYPE_TRIGGER, new TriggerComponent(this, triggerInfo)); if (!triggerInfo.empty()) m_Components.emplace(eReplicaComponentType::TRIGGER, new TriggerComponent(this, triggerInfo));
/** /**
* Setup groups * Setup groups
@ -159,30 +172,30 @@ void Entity::Initialize() {
} }
// Get the registry table // Get the registry table
CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance()->GetTable<CDComponentsRegistryTable>("ComponentsRegistry"); CDComponentsRegistryTable* compRegistryTable = CDClientManager::Instance().GetTable<CDComponentsRegistryTable>();
/** /**
* Special case for BBB models. They have components not corresponding to the registry. * Special case for BBB models. They have components not corresponding to the registry.
*/ */
if (m_TemplateID == 14) { if (m_TemplateID == 14) {
const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SIMPLE_PHYSICS); const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SIMPLE_PHYSICS);
SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this); SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SIMPLE_PHYSICS, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SIMPLE_PHYSICS, comp));
ModelComponent* modelcomp = new ModelComponent(this); ModelComponent* modelcomp = new ModelComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_MODEL, modelcomp)); m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, modelcomp));
RenderComponent* render = new RenderComponent(this); RenderComponent* render = new RenderComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_RENDER, render)); m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render));
auto destroyableComponent = new DestroyableComponent(this); auto destroyableComponent = new DestroyableComponent(this);
destroyableComponent->SetHealth(1); destroyableComponent->SetHealth(1);
destroyableComponent->SetMaxHealth(1.0f); destroyableComponent->SetMaxHealth(1.0f);
destroyableComponent->SetFaction(-1, true); destroyableComponent->SetFaction(-1, true);
destroyableComponent->SetIsSmashable(true); destroyableComponent->SetIsSmashable(true);
m_Components.insert(std::make_pair(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)); m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, destroyableComponent));
// We have all our components. // We have all our components.
return; return;
} }
@ -195,47 +208,47 @@ void Entity::Initialize() {
if (GetParentUser()) { if (GetParentUser()) {
auto missions = new MissionComponent(this); auto missions = new MissionComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_MISSION, missions)); m_Components.insert(std::make_pair(eReplicaComponentType::MISSION, missions));
missions->LoadFromXml(m_Character->GetXMLDoc()); missions->LoadFromXml(m_Character->GetXMLDoc());
} }
uint32_t petComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PET); uint32_t petComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PET);
if (petComponentId > 0) { if (petComponentId > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_PET, new PetComponent(this, petComponentId))); m_Components.insert(std::make_pair(eReplicaComponentType::PET, new PetComponent(this, petComponentId)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_ZONE_CONTROL) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ZONE_CONTROL) > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_ZONE_CONTROL, nullptr)); m_Components.insert(std::make_pair(eReplicaComponentType::ZONE_CONTROL, nullptr));
} }
uint32_t possessableComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_POSSESSABLE); uint32_t possessableComponentId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::POSSESSABLE);
if (possessableComponentId > 0) { if (possessableComponentId > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_POSSESSABLE, new PossessableComponent(this, possessableComponentId))); m_Components.insert(std::make_pair(eReplicaComponentType::POSSESSABLE, new PossessableComponent(this, possessableComponentId)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_MODULE_ASSEMBLY) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODULE_ASSEMBLY) > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_MODULE_ASSEMBLY, new ModuleAssemblyComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::MODULE_ASSEMBLY, new ModuleAssemblyComponent(this)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_RACING_STATS) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_STATS) > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_RACING_STATS, nullptr)); m_Components.insert(std::make_pair(eReplicaComponentType::RACING_STATS, nullptr));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_EXHIBIT, -1) >= 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::LUP_EXHIBIT, -1) >= 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_EXHIBIT, new LUPExhibitComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::LUP_EXHIBIT, new LUPExhibitComponent(this)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_RACING_CONTROL) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RACING_CONTROL) > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_RACING_CONTROL, new RacingControlComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::RACING_CONTROL, new RacingControlComponent(this)));
} }
const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PROPERTY_ENTRANCE); const auto propertyEntranceComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_ENTRANCE);
if (propertyEntranceComponentID > 0) { if (propertyEntranceComponentID > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_PROPERTY_ENTRANCE, m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY_ENTRANCE,
new PropertyEntranceComponent(propertyEntranceComponentID, this))); new PropertyEntranceComponent(propertyEntranceComponentID, this)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_CONTROLLABLE_PHYSICS) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CONTROLLABLE_PHYSICS) > 0) {
ControllablePhysicsComponent* controllablePhysics = new ControllablePhysicsComponent(this); ControllablePhysicsComponent* controllablePhysics = new ControllablePhysicsComponent(this);
if (m_Character) { if (m_Character) {
@ -270,68 +283,68 @@ void Entity::Initialize() {
controllablePhysics->SetRotation(m_DefaultRotation); controllablePhysics->SetRotation(m_DefaultRotation);
} }
m_Components.insert(std::make_pair(COMPONENT_TYPE_CONTROLLABLE_PHYSICS, controllablePhysics)); m_Components.insert(std::make_pair(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysics));
} }
// If an entity is marked a phantom, simple physics is made into phantom phyics. // If an entity is marked a phantom, simple physics is made into phantom phyics.
bool markedAsPhantom = GetVar<bool>(u"markedAsPhantom"); bool markedAsPhantom = GetVar<bool>(u"markedAsPhantom");
const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SIMPLE_PHYSICS); const auto simplePhysicsComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SIMPLE_PHYSICS);
if (!markedAsPhantom && simplePhysicsComponentID > 0) { if (!markedAsPhantom && simplePhysicsComponentID > 0) {
SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this); SimplePhysicsComponent* comp = new SimplePhysicsComponent(simplePhysicsComponentID, this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SIMPLE_PHYSICS, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SIMPLE_PHYSICS, comp));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS) > 0) {
RigidbodyPhantomPhysicsComponent* comp = new RigidbodyPhantomPhysicsComponent(this); RigidbodyPhantomPhysicsComponent* comp = new RigidbodyPhantomPhysicsComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, comp));
} }
if (markedAsPhantom || compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PHANTOM_PHYSICS) > 0) { if (markedAsPhantom || compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PHANTOM_PHYSICS) > 0) {
PhantomPhysicsComponent* phantomPhysics = new PhantomPhysicsComponent(this); PhantomPhysicsComponent* phantomPhysics = new PhantomPhysicsComponent(this);
phantomPhysics->SetPhysicsEffectActive(false); phantomPhysics->SetPhysicsEffectActive(false);
m_Components.insert(std::make_pair(COMPONENT_TYPE_PHANTOM_PHYSICS, phantomPhysics)); m_Components.insert(std::make_pair(eReplicaComponentType::PHANTOM_PHYSICS, phantomPhysics));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_VEHICLE_PHYSICS) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VEHICLE_PHYSICS) > 0) {
VehiclePhysicsComponent* vehiclePhysicsComponent = new VehiclePhysicsComponent(this); VehiclePhysicsComponent* vehiclePhysicsComponent = new VehiclePhysicsComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_VEHICLE_PHYSICS, vehiclePhysicsComponent)); m_Components.insert(std::make_pair(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent));
vehiclePhysicsComponent->SetPosition(m_DefaultPosition); vehiclePhysicsComponent->SetPosition(m_DefaultPosition);
vehiclePhysicsComponent->SetRotation(m_DefaultRotation); vehiclePhysicsComponent->SetRotation(m_DefaultRotation);
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SOUND_TRIGGER, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SOUND_TRIGGER, -1) != -1) {
auto* comp = new SoundTriggerComponent(this); auto* comp = new SoundTriggerComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SOUND_TRIGGER, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SOUND_TRIGGER, comp));
} }
//Also check for the collectible id: //Also check for the collectible id:
m_CollectibleID = GetVarAs<int32_t>(u"collectible_id"); m_CollectibleID = GetVarAs<int32_t>(u"collectible_id");
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_BUFF) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF) > 0) {
BuffComponent* comp = new BuffComponent(this); BuffComponent* comp = new BuffComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_BUFF, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::BUFF, comp));
} }
int collectibleComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_COLLECTIBLE); int collectibleComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::COLLECTIBLE);
if (collectibleComponentID > 0) { if (collectibleComponentID > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_COLLECTIBLE, nullptr)); m_Components.insert(std::make_pair(eReplicaComponentType::COLLECTIBLE, nullptr));
} }
/** /**
* Multiple components require the destructible component. * Multiple components require the destructible component.
*/ */
int buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_BUFF); int buffComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUFF);
int rebuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_REBUILD); int rebuildComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD);
int componentID = 0; int componentID = 0;
if (collectibleComponentID > 0) componentID = collectibleComponentID; if (collectibleComponentID > 0) componentID = collectibleComponentID;
if (rebuildComponentID > 0) componentID = rebuildComponentID; if (rebuildComponentID > 0) componentID = rebuildComponentID;
if (buffComponentID > 0) componentID = buffComponentID; if (buffComponentID > 0) componentID = buffComponentID;
CDDestructibleComponentTable* destCompTable = CDClientManager::Instance()->GetTable<CDDestructibleComponentTable>("DestructibleComponent"); CDDestructibleComponentTable* destCompTable = CDClientManager::Instance().GetTable<CDDestructibleComponentTable>();
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); }); std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); });
if (buffComponentID > 0 || collectibleComponentID > 0) { if (buffComponentID > 0 || collectibleComponentID > 0) {
@ -343,7 +356,7 @@ void Entity::Initialize() {
std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); }); std::vector<CDDestructibleComponent> destCompData = destCompTable->Query([=](CDDestructibleComponent entry) { return (entry.id == componentID); });
if (destCompData.size() > 0) { if (destCompData.size() > 0) {
if (HasComponent(COMPONENT_TYPE_RACING_STATS)) { if (HasComponent(eReplicaComponentType::RACING_STATS)) {
destCompData[0].imagination = 60; destCompData[0].imagination = 60;
} }
@ -363,7 +376,7 @@ void Entity::Initialize() {
uint32_t npcMinLevel = destCompData[0].level; uint32_t npcMinLevel = destCompData[0].level;
uint32_t currencyIndex = destCompData[0].CurrencyIndex; uint32_t currencyIndex = destCompData[0].CurrencyIndex;
CDCurrencyTableTable* currencyTable = CDClientManager::Instance()->GetTable<CDCurrencyTableTable>("CurrencyTable"); CDCurrencyTableTable* currencyTable = CDClientManager::Instance().GetTable<CDCurrencyTableTable>();
std::vector<CDCurrencyTable> currencyValues = currencyTable->Query([=](CDCurrencyTable entry) { return (entry.currencyIndex == currencyIndex && entry.npcminlevel == npcMinLevel); }); std::vector<CDCurrencyTable> currencyValues = currencyTable->Query([=](CDCurrencyTable entry) { return (entry.currencyIndex == currencyIndex && entry.npcminlevel == npcMinLevel); });
if (currencyValues.size() > 0) { if (currencyValues.size() > 0) {
@ -387,8 +400,8 @@ void Entity::Initialize() {
comp->AddFaction(6); //Smashables comp->AddFaction(6); //Smashables
// A race car has 60 imagination, other entities defaults to 0. // A race car has 60 imagination, other entities defaults to 0.
comp->SetImagination(HasComponent(COMPONENT_TYPE_RACING_STATS) ? 60 : 0); comp->SetImagination(HasComponent(eReplicaComponentType::RACING_STATS) ? 60 : 0);
comp->SetMaxImagination(HasComponent(COMPONENT_TYPE_RACING_STATS) ? 60 : 0); comp->SetMaxImagination(HasComponent(eReplicaComponentType::RACING_STATS) ? 60 : 0);
} }
} }
@ -406,43 +419,43 @@ void Entity::Initialize() {
} }
} }
m_Components.insert(std::make_pair(COMPONENT_TYPE_DESTROYABLE, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, comp));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_CHARACTER) > 0 || m_Character) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::CHARACTER) > 0 || m_Character) {
// Character Component always has a possessor, level, and forced movement components // Character Component always has a possessor, level, and forced movement components
m_Components.insert(std::make_pair(COMPONENT_TYPE_POSSESSOR, new PossessorComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::POSSESSOR, new PossessorComponent(this)));
// load in the xml for the level // load in the xml for the level
auto* levelComp = new LevelProgressionComponent(this); auto* levelComp = new LevelProgressionComponent(this);
levelComp->LoadFromXml(m_Character->GetXMLDoc()); levelComp->LoadFromXml(m_Character->GetXMLDoc());
m_Components.insert(std::make_pair(COMPONENT_TYPE_LEVEL_PROGRESSION, levelComp)); m_Components.insert(std::make_pair(eReplicaComponentType::LEVEL_PROGRESSION, levelComp));
m_Components.insert(std::make_pair(COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT, new PlayerForcedMovementComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::PLAYER_FORCED_MOVEMENT, new PlayerForcedMovementComponent(this)));
CharacterComponent* charComp = new CharacterComponent(this, m_Character); CharacterComponent* charComp = new CharacterComponent(this, m_Character);
charComp->LoadFromXml(m_Character->GetXMLDoc()); charComp->LoadFromXml(m_Character->GetXMLDoc());
m_Components.insert(std::make_pair(COMPONENT_TYPE_CHARACTER, charComp)); m_Components.insert(std::make_pair(eReplicaComponentType::CHARACTER, charComp));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_INVENTORY) > 0 || m_Character) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::INVENTORY) > 0 || m_Character) {
InventoryComponent* comp = nullptr; InventoryComponent* comp = nullptr;
if (m_Character) comp = new InventoryComponent(this, m_Character->GetXMLDoc()); if (m_Character) comp = new InventoryComponent(this, m_Character->GetXMLDoc());
else comp = new InventoryComponent(this); else comp = new InventoryComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_INVENTORY, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::INVENTORY, comp));
} }
// if this component exists, then we initialize it. it's value is always 0 // if this component exists, then we initialize it. it's value is always 0
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_ROCKET_LAUNCH_LUP, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ROCKET_LAUNCH_LUP, -1) != -1) {
auto comp = new RocketLaunchLupComponent(this); auto comp = new RocketLaunchLupComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_ROCKET_LAUNCH_LUP, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::ROCKET_LAUNCH_LUP, comp));
} }
/** /**
* This is a bit of a mess * This is a bit of a mess
*/ */
CDScriptComponentTable* scriptCompTable = CDClientManager::Instance()->GetTable<CDScriptComponentTable>("ScriptComponent"); CDScriptComponentTable* scriptCompTable = CDClientManager::Instance().GetTable<CDScriptComponentTable>();
int32_t scriptComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SCRIPT, -1); int32_t scriptComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPT, -1);
std::string scriptName = ""; std::string scriptName = "";
bool client = false; bool client = false;
@ -485,12 +498,12 @@ void Entity::Initialize() {
} }
if (!scriptName.empty() || client || m_Character || scriptComponentID >= 0) { if (!scriptName.empty() || client || m_Character || scriptComponentID >= 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_SCRIPT, new ScriptComponent(this, scriptName, true, client && scriptName.empty()))); m_Components.insert(std::make_pair(eReplicaComponentType::SCRIPT, new ScriptComponent(this, scriptName, true, client && scriptName.empty())));
} }
// ZoneControl script // ZoneControl script
if (m_TemplateID == 2365) { if (m_TemplateID == 2365) {
CDZoneTableTable* zoneTable = CDClientManager::Instance()->GetTable<CDZoneTableTable>("ZoneTable"); CDZoneTableTable* zoneTable = CDClientManager::Instance().GetTable<CDZoneTableTable>();
const auto zoneID = dZoneManager::Instance()->GetZoneID(); const auto zoneID = dZoneManager::Instance()->GetZoneID();
const CDZoneTable* zoneData = zoneTable->Query(zoneID.GetMapID()); const CDZoneTable* zoneData = zoneTable->Query(zoneID.GetMapID());
@ -499,26 +512,26 @@ void Entity::Initialize() {
CDScriptComponent zoneScriptData = scriptCompTable->GetByID(zoneScriptID); CDScriptComponent zoneScriptData = scriptCompTable->GetByID(zoneScriptID);
ScriptComponent* comp = new ScriptComponent(this, zoneScriptData.script_name, true); ScriptComponent* comp = new ScriptComponent(this, zoneScriptData.script_name, true);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SCRIPT, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SCRIPT, comp));
} }
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SKILL, -1) != -1 || m_Character) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SKILL, -1) != -1 || m_Character) {
SkillComponent* comp = new SkillComponent(this); SkillComponent* comp = new SkillComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SKILL, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SKILL, comp));
} }
const auto combatAiId = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_BASE_COMBAT_AI); const auto combatAiId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BASE_COMBAT_AI);
if (combatAiId > 0) { if (combatAiId > 0) {
BaseCombatAIComponent* comp = new BaseCombatAIComponent(this, combatAiId); BaseCombatAIComponent* comp = new BaseCombatAIComponent(this, combatAiId);
m_Components.insert(std::make_pair(COMPONENT_TYPE_BASE_COMBAT_AI, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::BASE_COMBAT_AI, comp));
} }
if (int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_REBUILD) > 0) { if (int componentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::QUICK_BUILD) > 0) {
RebuildComponent* comp = new RebuildComponent(this); RebuildComponent* comp = new RebuildComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_REBUILD, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::QUICK_BUILD, comp));
CDRebuildComponentTable* rebCompTable = CDClientManager::Instance()->GetTable<CDRebuildComponentTable>("RebuildComponent"); CDRebuildComponentTable* rebCompTable = CDClientManager::Instance().GetTable<CDRebuildComponentTable>();
std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([=](CDRebuildComponent entry) { return (entry.id == rebuildComponentID); }); std::vector<CDRebuildComponent> rebCompData = rebCompTable->Query([=](CDRebuildComponent entry) { return (entry.id == rebuildComponentID); });
if (rebCompData.size() > 0) { if (rebCompData.size() > 0) {
@ -556,89 +569,88 @@ void Entity::Initialize() {
} }
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SWITCH, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SWITCH, -1) != -1) {
SwitchComponent* comp = new SwitchComponent(this); SwitchComponent* comp = new SwitchComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_SWITCH, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::SWITCH, comp));
} }
if ((compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_VENDOR) > 0)) { if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::VENDOR) > 0)) {
VendorComponent* comp = new VendorComponent(this); VendorComponent* comp = new VendorComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_VENDOR, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::VENDOR, comp));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PROPERTY_VENDOR, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_VENDOR, -1) != -1) {
auto* component = new PropertyVendorComponent(this); auto* component = new PropertyVendorComponent(this);
m_Components.insert_or_assign(COMPONENT_TYPE_PROPERTY_VENDOR, component); m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_VENDOR, component);
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PROPERTY_MANAGEMENT, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY_MANAGEMENT, -1) != -1) {
auto* component = new PropertyManagementComponent(this); auto* component = new PropertyManagementComponent(this);
m_Components.insert_or_assign(COMPONENT_TYPE_PROPERTY_MANAGEMENT, component); m_Components.insert_or_assign(eReplicaComponentType::PROPERTY_MANAGEMENT, component);
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_BOUNCER, -1) != -1) { // you have to determine it like this because all bouncers have a componentID of 0 if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BOUNCER, -1) != -1) { // you have to determine it like this because all bouncers have a componentID of 0
BouncerComponent* comp = new BouncerComponent(this); BouncerComponent* comp = new BouncerComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_BOUNCER, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::BOUNCER, comp));
} }
if ((compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_RENDER) > 0 && m_TemplateID != 2365) || m_Character) { if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RENDER) > 0 && m_TemplateID != 2365) || m_Character) {
RenderComponent* render = new RenderComponent(this); RenderComponent* render = new RenderComponent(this);
m_Components.insert(std::make_pair(COMPONENT_TYPE_RENDER, render)); m_Components.insert(std::make_pair(eReplicaComponentType::RENDER, render));
} }
if ((compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_MISSION_OFFER) > 0) || m_Character) { if ((compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MISSION_OFFER) > 0) || m_Character) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_MISSION_OFFER, new MissionOfferComponent(this, m_TemplateID))); m_Components.insert(std::make_pair(eReplicaComponentType::MISSION_OFFER, new MissionOfferComponent(this, m_TemplateID)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_BUILD_BORDER, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::BUILD_BORDER, -1) != -1) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_BUILD_BORDER, new BuildBorderComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::BUILD_BORDER, new BuildBorderComponent(this)));
} }
// Scripted activity component // Scripted activity component
int scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SCRIPTED_ACTIVITY); int scriptedActivityID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SCRIPTED_ACTIVITY);
if ((scriptedActivityID > 0)) { if ((scriptedActivityID > 0)) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_SCRIPTED_ACTIVITY, new ScriptedActivityComponent(this, scriptedActivityID))); m_Components.insert(std::make_pair(eReplicaComponentType::SCRIPTED_ACTIVITY, new ScriptedActivityComponent(this, scriptedActivityID)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_MODEL, -1) != -1 && !(petComponentId > 0)) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MODEL, -1) != -1 && !(petComponentId > 0)) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_MODEL, new ModelComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::MODEL, new ModelComponent(this)));
if (m_Components.find(COMPONENT_TYPE_DESTROYABLE) == m_Components.end()) { if (m_Components.find(eReplicaComponentType::DESTROYABLE) == m_Components.end()) {
auto destroyableComponent = new DestroyableComponent(this); auto destroyableComponent = new DestroyableComponent(this);
destroyableComponent->SetHealth(1); destroyableComponent->SetHealth(1);
destroyableComponent->SetMaxHealth(1.0f); destroyableComponent->SetMaxHealth(1.0f);
destroyableComponent->SetFaction(-1, true); destroyableComponent->SetFaction(-1, true);
destroyableComponent->SetIsSmashable(true); destroyableComponent->SetIsSmashable(true);
m_Components.insert(std::make_pair(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)); m_Components.insert(std::make_pair(eReplicaComponentType::DESTROYABLE, destroyableComponent));
} }
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ITEM) > 0 && !(petComponentId > 0)) {
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_ITEM) > 0 && !(petComponentId > 0)) { m_Components.insert(std::make_pair(eReplicaComponentType::ITEM, nullptr));
m_Components.emplace(COMPONENT_TYPE_ITEM, new ItemComponent(this));
} }
// Shooting gallery component // Shooting gallery component
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_SHOOTING_GALLERY) > 0) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::SHOOTING_GALLERY) > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_SHOOTING_GALLERY, new ShootingGalleryComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::SHOOTING_GALLERY, new ShootingGalleryComponent(this)));
} }
if (compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PROPERTY, -1) != -1) { if (compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROPERTY, -1) != -1) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_PROPERTY, new PropertyComponent(this))); m_Components.insert(std::make_pair(eReplicaComponentType::PROPERTY, new PropertyComponent(this)));
} }
const int rocketId = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_ROCKET_LAUNCH); const int rocketId = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::ROCKET_LAUNCH);
if ((rocketId > 0)) { if ((rocketId > 0)) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_ROCKET_LAUNCH, new RocketLaunchpadControlComponent(this, rocketId))); m_Components.insert(std::make_pair(eReplicaComponentType::ROCKET_LAUNCH, new RocketLaunchpadControlComponent(this, rocketId)));
} }
const int32_t railComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_RAIL_ACTIVATOR); const int32_t railComponentID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::RAIL_ACTIVATOR);
if (railComponentID > 0) { if (railComponentID > 0) {
m_Components.insert(std::make_pair(COMPONENT_TYPE_RAIL_ACTIVATOR, new RailActivatorComponent(this, railComponentID))); m_Components.insert(std::make_pair(eReplicaComponentType::RAIL_ACTIVATOR, new RailActivatorComponent(this, railComponentID)));
} }
int movementAIID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_MOVEMENT_AI); int movementAIID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::MOVEMENT_AI);
if (movementAIID > 0) { if (movementAIID > 0) {
CDMovementAIComponentTable* moveAITable = CDClientManager::Instance()->GetTable<CDMovementAIComponentTable>("MovementAIComponent"); CDMovementAIComponentTable* moveAITable = CDClientManager::Instance().GetTable<CDMovementAIComponentTable>();
std::vector<CDMovementAIComponent> moveAIComp = moveAITable->Query([=](CDMovementAIComponent entry) {return (entry.id == movementAIID); }); std::vector<CDMovementAIComponent> moveAIComp = moveAITable->Query([=](CDMovementAIComponent entry) {return (entry.id == movementAIID); });
if (moveAIComp.size() > 0) { if (moveAIComp.size() > 0) {
@ -661,7 +673,7 @@ void Entity::Initialize() {
} }
} }
m_Components.insert(std::make_pair(COMPONENT_TYPE_MOVEMENT_AI, new MovementAIComponent(this, moveInfo))); m_Components.insert(std::make_pair(eReplicaComponentType::MOVEMENT_AI, new MovementAIComponent(this, moveInfo)));
} }
} else if (petComponentId > 0 || combatAiId > 0 && GetComponent<BaseCombatAIComponent>()->GetTetherSpeed() > 0) { } else if (petComponentId > 0 || combatAiId > 0 && GetComponent<BaseCombatAIComponent>()->GetTetherSpeed() > 0) {
MovementAIInfo moveInfo = MovementAIInfo(); MovementAIInfo moveInfo = MovementAIInfo();
@ -672,7 +684,7 @@ void Entity::Initialize() {
moveInfo.wanderDelayMax = 5; moveInfo.wanderDelayMax = 5;
moveInfo.wanderDelayMin = 2; moveInfo.wanderDelayMin = 2;
m_Components.insert(std::make_pair(COMPONENT_TYPE_MOVEMENT_AI, new MovementAIComponent(this, moveInfo))); m_Components.insert(std::make_pair(eReplicaComponentType::MOVEMENT_AI, new MovementAIComponent(this, moveInfo)));
} }
std::string pathName = GetVarAsString(u"attached_path"); std::string pathName = GetVarAsString(u"attached_path");
@ -683,7 +695,7 @@ void Entity::Initialize() {
// if we have a moving platform path, then we need a moving platform component // if we have a moving platform path, then we need a moving platform component
if (path->pathType == PathType::MovingPlatform) { if (path->pathType == PathType::MovingPlatform) {
MovingPlatformComponent* plat = new MovingPlatformComponent(this, pathName); MovingPlatformComponent* plat = new MovingPlatformComponent(this, pathName);
m_Components.insert(std::make_pair(COMPONENT_TYPE_MOVING_PLATFORM, plat)); m_Components.insert(std::make_pair(eReplicaComponentType::MOVING_PLATFORM, plat));
// else if we are a movement path // else if we are a movement path
} /*else if (path->pathType == PathType::Movement) { } /*else if (path->pathType == PathType::Movement) {
auto movementAIcomp = GetComponent<MovementAIComponent>(); auto movementAIcomp = GetComponent<MovementAIComponent>();
@ -695,14 +707,14 @@ void Entity::Initialize() {
}*/ }*/
} }
int proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, COMPONENT_TYPE_PROXIMITY_MONITOR); int proximityMonitorID = compRegistryTable->GetByIDAndType(m_TemplateID, eReplicaComponentType::PROXIMITY_MONITOR);
if (proximityMonitorID > 0) { if (proximityMonitorID > 0) {
CDProximityMonitorComponentTable* proxCompTable = CDClientManager::Instance()->GetTable<CDProximityMonitorComponentTable>("ProximityMonitorComponent"); CDProximityMonitorComponentTable* proxCompTable = CDClientManager::Instance().GetTable<CDProximityMonitorComponentTable>();
std::vector<CDProximityMonitorComponent> proxCompData = proxCompTable->Query([=](CDProximityMonitorComponent entry) { return (entry.id == proximityMonitorID); }); std::vector<CDProximityMonitorComponent> proxCompData = proxCompTable->Query([=](CDProximityMonitorComponent entry) { return (entry.id == proximityMonitorID); });
if (proxCompData.size() > 0) { if (proxCompData.size() > 0) {
std::vector<std::string> proximityStr = GeneralUtils::SplitString(proxCompData[0].Proximities, ','); std::vector<std::string> proximityStr = GeneralUtils::SplitString(proxCompData[0].Proximities, ',');
ProximityMonitorComponent* comp = new ProximityMonitorComponent(this, std::stoi(proximityStr[0]), std::stoi(proximityStr[1])); ProximityMonitorComponent* comp = new ProximityMonitorComponent(this, std::stoi(proximityStr[0]), std::stoi(proximityStr[1]));
m_Components.insert(std::make_pair(COMPONENT_TYPE_PROXIMITY_MONITOR, comp)); m_Components.insert(std::make_pair(eReplicaComponentType::PROXIMITY_MONITOR, comp));
} }
} }
@ -715,7 +727,7 @@ void Entity::Initialize() {
if (!m_Character && EntityManager::Instance()->GetGhostingEnabled()) { if (!m_Character && EntityManager::Instance()->GetGhostingEnabled()) {
// Don't ghost what is likely large scene elements // Don't ghost what is likely large scene elements
if (m_Components.size() == 2 && HasComponent(COMPONENT_TYPE_SIMPLE_PHYSICS) && HasComponent(COMPONENT_TYPE_RENDER)) { if (m_Components.size() == 2 && HasComponent(eReplicaComponentType::SIMPLE_PHYSICS) && HasComponent(eReplicaComponentType::RENDER)) {
goto no_ghosting; goto no_ghosting;
} }
@ -727,14 +739,14 @@ void Entity::Initialize() {
*/ */
if ( if (
!EntityManager::IsExcludedFromGhosting(GetLOT()) && !EntityManager::IsExcludedFromGhosting(GetLOT()) &&
!HasComponent(COMPONENT_TYPE_SCRIPTED_ACTIVITY) && !HasComponent(eReplicaComponentType::SCRIPTED_ACTIVITY) &&
!HasComponent(COMPONENT_TYPE_MOVING_PLATFORM) && !HasComponent(eReplicaComponentType::MOVING_PLATFORM) &&
!HasComponent(COMPONENT_TYPE_PHANTOM_PHYSICS) && !HasComponent(eReplicaComponentType::PHANTOM_PHYSICS) &&
!HasComponent(COMPONENT_TYPE_PROPERTY) && !HasComponent(eReplicaComponentType::PROPERTY) &&
!HasComponent(COMPONENT_TYPE_RACING_CONTROL) && !HasComponent(eReplicaComponentType::RACING_CONTROL) &&
!HasComponent(COMPONENT_TYPE_VEHICLE_PHYSICS) !HasComponent(eReplicaComponentType::VEHICLE_PHYSICS)
) )
//if (HasComponent(COMPONENT_TYPE_BASE_COMBAT_AI)) //if (HasComponent(eReplicaComponentType::BASE_COMBAT_AI))
{ {
m_IsGhostingCandidate = true; m_IsGhostingCandidate = true;
} }
@ -744,7 +756,7 @@ void Entity::Initialize() {
} }
// Special case for collectibles in Ninjago // Special case for collectibles in Ninjago
if (HasComponent(COMPONENT_TYPE_COLLECTIBLE) && Game::server->GetZoneID() == 2000) { if (HasComponent(eReplicaComponentType::COLLECTIBLE) && Game::server->GetZoneID() == 2000) {
m_IsGhostingCandidate = true; m_IsGhostingCandidate = true;
} }
} }
@ -779,7 +791,7 @@ User* Entity::GetParentUser() const {
return static_cast<const Player*>(this)->GetParentUser(); return static_cast<const Player*>(this)->GetParentUser();
} }
Component* Entity::GetComponent(int32_t componentID) const { Component* Entity::GetComponent(eReplicaComponentType componentID) const {
const auto& index = m_Components.find(componentID); const auto& index = m_Components.find(componentID);
if (index == m_Components.end()) { if (index == m_Components.end()) {
@ -789,11 +801,11 @@ Component* Entity::GetComponent(int32_t componentID) const {
return index->second; return index->second;
} }
bool Entity::HasComponent(const int32_t componentId) const { bool Entity::HasComponent(const eReplicaComponentType componentId) const {
return m_Components.find(componentId) != m_Components.end(); return m_Components.find(componentId) != m_Components.end();
} }
void Entity::AddComponent(const int32_t componentId, Component* component) { void Entity::AddComponent(const eReplicaComponentType componentId, Component* component) {
if (HasComponent(componentId)) { if (HasComponent(componentId)) {
return; return;
} }
@ -803,8 +815,8 @@ void Entity::AddComponent(const int32_t componentId, Component* component) {
std::vector<ScriptComponent*> Entity::GetScriptComponents() { std::vector<ScriptComponent*> Entity::GetScriptComponents() {
std::vector<ScriptComponent*> comps; std::vector<ScriptComponent*> comps;
for (std::pair<int32_t, void*> p : m_Components) { for (std::pair<eReplicaComponentType, void*> p : m_Components) {
if (p.first == COMPONENT_TYPE_SCRIPT) { if (p.first == eReplicaComponentType::SCRIPT) {
comps.push_back(static_cast<ScriptComponent*>(p.second)); comps.push_back(static_cast<ScriptComponent*>(p.second));
} }
} }
@ -832,7 +844,7 @@ void Entity::SetProximityRadius(float proxRadius, std::string name) {
ProximityMonitorComponent* proxMon = GetComponent<ProximityMonitorComponent>(); ProximityMonitorComponent* proxMon = GetComponent<ProximityMonitorComponent>();
if (!proxMon) { if (!proxMon) {
proxMon = new ProximityMonitorComponent(this); proxMon = new ProximityMonitorComponent(this);
m_Components.insert_or_assign(COMPONENT_TYPE_PROXIMITY_MONITOR, proxMon); m_Components.insert_or_assign(eReplicaComponentType::PROXIMITY_MONITOR, proxMon);
} }
proxMon->SetProximityRadius(proxRadius, name); proxMon->SetProximityRadius(proxRadius, name);
} }
@ -841,7 +853,7 @@ void Entity::SetProximityRadius(dpEntity* entity, std::string name) {
ProximityMonitorComponent* proxMon = GetComponent<ProximityMonitorComponent>(); ProximityMonitorComponent* proxMon = GetComponent<ProximityMonitorComponent>();
if (!proxMon) { if (!proxMon) {
proxMon = new ProximityMonitorComponent(this); proxMon = new ProximityMonitorComponent(this);
m_Components.insert_or_assign(COMPONENT_TYPE_PROXIMITY_MONITOR, proxMon); m_Components.insert_or_assign(eReplicaComponentType::PROXIMITY_MONITOR, proxMon);
} }
proxMon->SetProximityRadius(entity, name); proxMon->SetProximityRadius(entity, name);
} }
@ -929,7 +941,7 @@ void Entity::WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacke
} }
TriggerComponent* triggerComponent; TriggerComponent* triggerComponent;
if (TryGetComponent(COMPONENT_TYPE_TRIGGER, triggerComponent)) { if (TryGetComponent(eReplicaComponentType::TRIGGER, triggerComponent)) {
// has trigger component, check to see if we have events to handle // has trigger component, check to see if we have events to handle
auto* trigger = triggerComponent->GetTrigger(); auto* trigger = triggerComponent->GetTrigger();
outBitStream->Write<bool>(trigger && trigger->events.size() > 0); outBitStream->Write<bool>(trigger && trigger->events.size() > 0);
@ -995,59 +1007,59 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
unsigned int flags = 0; unsigned int flags = 0;
PossessableComponent* possessableComponent; PossessableComponent* possessableComponent;
if (TryGetComponent(COMPONENT_TYPE_POSSESSABLE, possessableComponent)) { if (TryGetComponent(eReplicaComponentType::POSSESSABLE, possessableComponent)) {
possessableComponent->Serialize(outBitStream, bIsInitialUpdate, flags); possessableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ModuleAssemblyComponent* moduleAssemblyComponent; ModuleAssemblyComponent* moduleAssemblyComponent;
if (TryGetComponent(COMPONENT_TYPE_MODULE_ASSEMBLY, moduleAssemblyComponent)) { if (TryGetComponent(eReplicaComponentType::MODULE_ASSEMBLY, moduleAssemblyComponent)) {
moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate, flags); moduleAssemblyComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ControllablePhysicsComponent* controllablePhysicsComponent; ControllablePhysicsComponent* controllablePhysicsComponent;
if (TryGetComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) { if (TryGetComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS, controllablePhysicsComponent)) {
controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags); controllablePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
SimplePhysicsComponent* simplePhysicsComponent; SimplePhysicsComponent* simplePhysicsComponent;
if (TryGetComponent(COMPONENT_TYPE_SIMPLE_PHYSICS, simplePhysicsComponent)) { if (TryGetComponent(eReplicaComponentType::SIMPLE_PHYSICS, simplePhysicsComponent)) {
simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags); simplePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
RigidbodyPhantomPhysicsComponent* rigidbodyPhantomPhysics; RigidbodyPhantomPhysicsComponent* rigidbodyPhantomPhysics;
if (TryGetComponent(COMPONENT_TYPE_RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) { if (TryGetComponent(eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS, rigidbodyPhantomPhysics)) {
rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags); rigidbodyPhantomPhysics->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
VehiclePhysicsComponent* vehiclePhysicsComponent; VehiclePhysicsComponent* vehiclePhysicsComponent;
if (TryGetComponent(COMPONENT_TYPE_VEHICLE_PHYSICS, vehiclePhysicsComponent)) { if (TryGetComponent(eReplicaComponentType::VEHICLE_PHYSICS, vehiclePhysicsComponent)) {
vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags); vehiclePhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
PhantomPhysicsComponent* phantomPhysicsComponent; PhantomPhysicsComponent* phantomPhysicsComponent;
if (TryGetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS, phantomPhysicsComponent)) { if (TryGetComponent(eReplicaComponentType::PHANTOM_PHYSICS, phantomPhysicsComponent)) {
phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags); phantomPhysicsComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
SoundTriggerComponent* soundTriggerComponent; SoundTriggerComponent* soundTriggerComponent;
if (TryGetComponent(COMPONENT_TYPE_SOUND_TRIGGER, soundTriggerComponent)) { if (TryGetComponent(eReplicaComponentType::SOUND_TRIGGER, soundTriggerComponent)) {
soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags); soundTriggerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
BuffComponent* buffComponent; BuffComponent* buffComponent;
if (TryGetComponent(COMPONENT_TYPE_BUFF, buffComponent)) { if (TryGetComponent(eReplicaComponentType::BUFF, buffComponent)) {
buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags); buffComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
DestroyableComponent* destroyableComponent; DestroyableComponent* destroyableComponent;
if (TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)) { if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags); destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
destroyableSerialized = true; destroyableSerialized = true;
} }
if (HasComponent(COMPONENT_TYPE_COLLECTIBLE)) { if (HasComponent(eReplicaComponentType::COLLECTIBLE)) {
DestroyableComponent* destroyableComponent; DestroyableComponent* destroyableComponent;
if (TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent) && !destroyableSerialized) { if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags); destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
destroyableSerialized = true; destroyableSerialized = true;
@ -1055,15 +1067,15 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
} }
PetComponent* petComponent; PetComponent* petComponent;
if (TryGetComponent(COMPONENT_TYPE_PET, petComponent)) { if (TryGetComponent(eReplicaComponentType::PET, petComponent)) {
petComponent->Serialize(outBitStream, bIsInitialUpdate, flags); petComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
CharacterComponent* characterComponent; CharacterComponent* characterComponent;
if (TryGetComponent(COMPONENT_TYPE_CHARACTER, characterComponent)) { if (TryGetComponent(eReplicaComponentType::CHARACTER, characterComponent)) {
PossessorComponent* possessorComponent; PossessorComponent* possessorComponent;
if (TryGetComponent(COMPONENT_TYPE_POSSESSOR, possessorComponent)) { if (TryGetComponent(eReplicaComponentType::POSSESSOR, possessorComponent)) {
possessorComponent->Serialize(outBitStream, bIsInitialUpdate, flags); possessorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} else { } else {
// Should never happen, but just to be safe // Should never happen, but just to be safe
@ -1071,7 +1083,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
} }
LevelProgressionComponent* levelProgressionComponent; LevelProgressionComponent* levelProgressionComponent;
if (TryGetComponent(COMPONENT_TYPE_LEVEL_PROGRESSION, levelProgressionComponent)) { if (TryGetComponent(eReplicaComponentType::LEVEL_PROGRESSION, levelProgressionComponent)) {
levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate, flags); levelProgressionComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} else { } else {
// Should never happen, but just to be safe // Should never happen, but just to be safe
@ -1079,7 +1091,7 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
} }
PlayerForcedMovementComponent* playerForcedMovementComponent; PlayerForcedMovementComponent* playerForcedMovementComponent;
if (TryGetComponent(COMPONENT_TYPE_PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) { if (TryGetComponent(eReplicaComponentType::PLAYER_FORCED_MOVEMENT, playerForcedMovementComponent)) {
playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags); playerForcedMovementComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} else { } else {
// Should never happen, but just to be safe // Should never happen, but just to be safe
@ -1090,34 +1102,34 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
} }
ItemComponent* itemComponent; ItemComponent* itemComponent;
if (TryGetComponent(COMPONENT_TYPE_ITEM, itemComponent)) { if (TryGetComponent(eReplicaComponentType::ITEM, itemComponent)) {
itemComponent->Serialize(outBitStream, bIsInitialUpdate, flags); itemComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
InventoryComponent* inventoryComponent; InventoryComponent* inventoryComponent;
if (TryGetComponent(COMPONENT_TYPE_INVENTORY, inventoryComponent)) { if (TryGetComponent(eReplicaComponentType::INVENTORY, inventoryComponent)) {
inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags); inventoryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ScriptComponent* scriptComponent; ScriptComponent* scriptComponent;
if (TryGetComponent(COMPONENT_TYPE_SCRIPT, scriptComponent)) { if (TryGetComponent(eReplicaComponentType::SCRIPT, scriptComponent)) {
scriptComponent->Serialize(outBitStream, bIsInitialUpdate, flags); scriptComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
SkillComponent* skillComponent; SkillComponent* skillComponent;
if (TryGetComponent(COMPONENT_TYPE_SKILL, skillComponent)) { if (TryGetComponent(eReplicaComponentType::SKILL, skillComponent)) {
skillComponent->Serialize(outBitStream, bIsInitialUpdate, flags); skillComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
BaseCombatAIComponent* baseCombatAiComponent; BaseCombatAIComponent* baseCombatAiComponent;
if (TryGetComponent(COMPONENT_TYPE_BASE_COMBAT_AI, baseCombatAiComponent)) { if (TryGetComponent(eReplicaComponentType::BASE_COMBAT_AI, baseCombatAiComponent)) {
baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags); baseCombatAiComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
RebuildComponent* rebuildComponent; RebuildComponent* rebuildComponent;
if (TryGetComponent(COMPONENT_TYPE_REBUILD, rebuildComponent)) { if (TryGetComponent(eReplicaComponentType::QUICK_BUILD, rebuildComponent)) {
DestroyableComponent* destroyableComponent; DestroyableComponent* destroyableComponent;
if (TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent) && !destroyableSerialized) { if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags); destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
destroyableSerialized = true; destroyableSerialized = true;
@ -1125,64 +1137,64 @@ void Entity::WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType
} }
MovingPlatformComponent* movingPlatformComponent; MovingPlatformComponent* movingPlatformComponent;
if (TryGetComponent(COMPONENT_TYPE_MOVING_PLATFORM, movingPlatformComponent)) { if (TryGetComponent(eReplicaComponentType::MOVING_PLATFORM, movingPlatformComponent)) {
movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags); movingPlatformComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
SwitchComponent* switchComponent; SwitchComponent* switchComponent;
if (TryGetComponent(COMPONENT_TYPE_SWITCH, switchComponent)) { if (TryGetComponent(eReplicaComponentType::SWITCH, switchComponent)) {
switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags); switchComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
VendorComponent* vendorComponent; VendorComponent* vendorComponent;
if (TryGetComponent(COMPONENT_TYPE_VENDOR, vendorComponent)) { if (TryGetComponent(eReplicaComponentType::VENDOR, vendorComponent)) {
vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags); vendorComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
BouncerComponent* bouncerComponent; BouncerComponent* bouncerComponent;
if (TryGetComponent(COMPONENT_TYPE_BOUNCER, bouncerComponent)) { if (TryGetComponent(eReplicaComponentType::BOUNCER, bouncerComponent)) {
bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags); bouncerComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ScriptedActivityComponent* scriptedActivityComponent; ScriptedActivityComponent* scriptedActivityComponent;
if (TryGetComponent(COMPONENT_TYPE_SCRIPTED_ACTIVITY, scriptedActivityComponent)) { if (TryGetComponent(eReplicaComponentType::SCRIPTED_ACTIVITY, scriptedActivityComponent)) {
scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags); scriptedActivityComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ShootingGalleryComponent* shootingGalleryComponent; ShootingGalleryComponent* shootingGalleryComponent;
if (TryGetComponent(COMPONENT_TYPE_SHOOTING_GALLERY, shootingGalleryComponent)) { if (TryGetComponent(eReplicaComponentType::SHOOTING_GALLERY, shootingGalleryComponent)) {
shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags); shootingGalleryComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
RacingControlComponent* racingControlComponent; RacingControlComponent* racingControlComponent;
if (TryGetComponent(COMPONENT_TYPE_RACING_CONTROL, racingControlComponent)) { if (TryGetComponent(eReplicaComponentType::RACING_CONTROL, racingControlComponent)) {
racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags); racingControlComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
LUPExhibitComponent* lupExhibitComponent; LUPExhibitComponent* lupExhibitComponent;
if (TryGetComponent(COMPONENT_TYPE_EXHIBIT, lupExhibitComponent)) { if (TryGetComponent(eReplicaComponentType::LUP_EXHIBIT, lupExhibitComponent)) {
lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags); lupExhibitComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
ModelComponent* modelComponent; ModelComponent* modelComponent;
if (TryGetComponent(COMPONENT_TYPE_MODEL, modelComponent)) { if (TryGetComponent(eReplicaComponentType::MODEL, modelComponent)) {
modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags); modelComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
RenderComponent* renderComponent; RenderComponent* renderComponent;
if (TryGetComponent(COMPONENT_TYPE_RENDER, renderComponent)) { if (TryGetComponent(eReplicaComponentType::RENDER, renderComponent)) {
renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags); renderComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
} }
if (modelComponent) { if (modelComponent) {
DestroyableComponent* destroyableComponent; DestroyableComponent* destroyableComponent;
if (TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent) && !destroyableSerialized) { if (TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent) && !destroyableSerialized) {
destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags); destroyableComponent->Serialize(outBitStream, bIsInitialUpdate, flags);
destroyableSerialized = true; destroyableSerialized = true;
} }
} }
if (HasComponent(COMPONENT_TYPE_ZONE_CONTROL)) { if (HasComponent(eReplicaComponentType::ZONE_CONTROL)) {
outBitStream->Write<uint32_t>(0x40000000); outBitStream->Write<uint32_t>(0x40000000);
} }
@ -1578,7 +1590,7 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
InventoryComponent* inv = GetComponent<InventoryComponent>(); InventoryComponent* inv = GetComponent<InventoryComponent>();
if (!inv) return; if (!inv) return;
CDObjectsTable* objectsTable = CDClientManager::Instance()->GetTable<CDObjectsTable>("Objects"); CDObjectsTable* objectsTable = CDClientManager::Instance().GetTable<CDObjectsTable>();
auto& droppedLoot = static_cast<Player*>(this)->GetDroppedLoot(); auto& droppedLoot = static_cast<Player*>(this)->GetDroppedLoot();
@ -1591,10 +1603,10 @@ void Entity::PickupItem(const LWOOBJID& objectID) {
const CDObjects& object = objectsTable->GetByID(p.second.lot); const CDObjects& object = objectsTable->GetByID(p.second.lot);
if (object.id != 0 && object.type == "Powerup") { if (object.id != 0 && object.type == "Powerup") {
CDObjectSkillsTable* skillsTable = CDClientManager::Instance()->GetTable<CDObjectSkillsTable>("ObjectSkills"); CDObjectSkillsTable* skillsTable = CDClientManager::Instance().GetTable<CDObjectSkillsTable>();
std::vector<CDObjectSkills> skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == p.second.lot); }); std::vector<CDObjectSkills> skills = skillsTable->Query([=](CDObjectSkills entry) {return (entry.objectTemplate == p.second.lot); });
for (CDObjectSkills skill : skills) { for (CDObjectSkills skill : skills) {
CDSkillBehaviorTable* skillBehTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior"); CDSkillBehaviorTable* skillBehTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
CDSkillBehavior behaviorData = skillBehTable->GetSkillByID(skill.skillID); CDSkillBehavior behaviorData = skillBehTable->GetSkillByID(skill.skillID);
SkillComponent::HandleUnmanaged(behaviorData.behaviorID, GetObjectID()); SkillComponent::HandleUnmanaged(behaviorData.behaviorID, GetObjectID());

View File

@ -31,6 +31,7 @@ class Item;
class Character; class Character;
class EntityCallbackTimer; class EntityCallbackTimer;
enum class eTriggerEventType; enum class eTriggerEventType;
enum class eReplicaComponentType : uint32_t;
namespace CppScripts { namespace CppScripts {
class Script; class Script;
@ -131,17 +132,17 @@ public:
* Component management * Component management
*/ */
Component* GetComponent(int32_t componentID) const; Component* GetComponent(eReplicaComponentType componentID) const;
template<typename T> template<typename T>
T* GetComponent() const; T* GetComponent() const;
template<typename T> template<typename T>
bool TryGetComponent(int32_t componentId, T*& component) const; bool TryGetComponent(eReplicaComponentType componentId, T*& component) const;
bool HasComponent(int32_t componentId) const; bool HasComponent(eReplicaComponentType componentId) const;
void AddComponent(int32_t componentId, Component* component); void AddComponent(eReplicaComponentType componentId, Component* component);
std::vector<ScriptComponent*> GetScriptComponents(); std::vector<ScriptComponent*> GetScriptComponents();
@ -164,7 +165,7 @@ public:
void AddToGroup(const std::string& group); void AddToGroup(const std::string& group);
bool IsPlayer() const; bool IsPlayer() const;
std::unordered_map<int32_t, Component*>& GetComponents() { return m_Components; } // TODO: Remove std::unordered_map<eReplicaComponentType, Component*>& GetComponents() { return m_Components; } // TODO: Remove
void WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType); void WriteBaseReplicaData(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
void WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType packetType); void WriteComponents(RakNet::BitStream* outBitStream, eReplicaPacketType packetType);
@ -314,7 +315,7 @@ protected:
std::vector<std::function<void()>> m_DieCallbacks; std::vector<std::function<void()>> m_DieCallbacks;
std::vector<std::function<void(Entity* target)>> m_PhantomCollisionCallbacks; std::vector<std::function<void(Entity* target)>> m_PhantomCollisionCallbacks;
std::unordered_map<int32_t, Component*> m_Components; //The int is the ID of the component std::unordered_map<eReplicaComponentType, Component*> m_Components;
std::vector<EntityTimer*> m_Timers; std::vector<EntityTimer*> m_Timers;
std::vector<EntityTimer*> m_PendingTimers; std::vector<EntityTimer*> m_PendingTimers;
std::vector<EntityCallbackTimer*> m_CallbackTimers; std::vector<EntityCallbackTimer*> m_CallbackTimers;
@ -344,7 +345,7 @@ protected:
*/ */
template<typename T> template<typename T>
bool Entity::TryGetComponent(const int32_t componentId, T*& component) const { bool Entity::TryGetComponent(const eReplicaComponentType componentId, T*& component) const {
const auto& index = m_Components.find(componentId); const auto& index = m_Components.find(componentId);
if (index == m_Components.end()) { if (index == m_Components.end()) {

View File

@ -20,6 +20,7 @@
#include "MessageIdentifiers.h" #include "MessageIdentifiers.h"
#include "dConfig.h" #include "dConfig.h"
#include "eTriggerEventType.h" #include "eTriggerEventType.h"
#include "eReplicaComponentType.h"
EntityManager* EntityManager::m_Address = nullptr; EntityManager* EntityManager::m_Address = nullptr;
@ -268,10 +269,10 @@ std::vector<Entity*> EntityManager::GetEntitiesInGroup(const std::string& group)
return entitiesInGroup; return entitiesInGroup;
} }
std::vector<Entity*> EntityManager::GetEntitiesByComponent(const int componentType) const { std::vector<Entity*> EntityManager::GetEntitiesByComponent(const eReplicaComponentType componentType) const {
std::vector<Entity*> withComp; std::vector<Entity*> withComp;
for (const auto& entity : m_Entities) { for (const auto& entity : m_Entities) {
if (componentType != -1 && !entity.second->HasComponent(componentType)) continue; if (componentType != eReplicaComponentType::INVALID && !entity.second->HasComponent(componentType)) continue;
withComp.push_back(entity.second); withComp.push_back(entity.second);
} }

View File

@ -11,6 +11,7 @@ class Entity;
class EntityInfo; class EntityInfo;
class Player; class Player;
class User; class User;
enum class eReplicaComponentType : uint32_t;
struct SystemAddress; struct SystemAddress;
@ -35,7 +36,7 @@ public:
void DestroyEntity(Entity* entity); void DestroyEntity(Entity* entity);
Entity* GetEntity(const LWOOBJID& objectId) const; Entity* GetEntity(const LWOOBJID& objectId) const;
std::vector<Entity*> GetEntitiesInGroup(const std::string& group); std::vector<Entity*> GetEntitiesInGroup(const std::string& group);
std::vector<Entity*> GetEntitiesByComponent(int componentType) const; std::vector<Entity*> GetEntitiesByComponent(eReplicaComponentType componentType) const;
std::vector<Entity*> GetEntitiesByLOT(const LOT& lot) const; std::vector<Entity*> GetEntitiesByLOT(const LOT& lot) const;
Entity* GetZoneControlEntity() const; Entity* GetZoneControlEntity() const;

View File

@ -8,6 +8,10 @@
#include "dLogger.h" #include "dLogger.h"
#include "dConfig.h" #include "dConfig.h"
#include "CDClientManager.h" #include "CDClientManager.h"
#include "GeneralUtils.h"
#include "Entity.h"
#include "CDActivitiesTable.h"
Leaderboard::Leaderboard(uint32_t gameID, uint32_t infoType, bool weekly, std::vector<LeaderboardEntry> entries, Leaderboard::Leaderboard(uint32_t gameID, uint32_t infoType, bool weekly, std::vector<LeaderboardEntry> entries,
LWOOBJID relatedPlayer, LeaderboardType leaderboardType) { LWOOBJID relatedPlayer, LeaderboardType leaderboardType) {
@ -273,7 +277,7 @@ void LeaderboardManager::SendLeaderboard(uint32_t gameID, InfoType infoType, boo
} }
LeaderboardType LeaderboardManager::GetLeaderboardType(uint32_t gameID) { LeaderboardType LeaderboardManager::GetLeaderboardType(uint32_t gameID) {
auto* activitiesTable = CDClientManager::Instance()->GetTable<CDActivitiesTable>("Activities"); auto* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
std::vector<CDActivities> activities = activitiesTable->Query([=](const CDActivities& entry) { std::vector<CDActivities> activities = activitiesTable->Query([=](const CDActivities& entry) {
return (entry.ActivityID == gameID); return (entry.ActivityID == gameID);
}); });

View File

@ -16,6 +16,7 @@
#include "User.h" #include "User.h"
#include "CppScripts.h" #include "CppScripts.h"
#include "Loot.h" #include "Loot.h"
#include "eReplicaComponentType.h"
std::vector<Player*> Player::m_Players = {}; std::vector<Player*> Player::m_Players = {};
@ -223,7 +224,7 @@ Player* Player::GetPlayer(const SystemAddress& sysAddr) {
} }
Player* Player::GetPlayer(const std::string& name) { Player* Player::GetPlayer(const std::string& name) {
const auto characters = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CHARACTER); const auto characters = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CHARACTER);
for (auto* character : characters) { for (auto* character : characters) {
if (!character->IsPlayer()) continue; if (!character->IsPlayer()) continue;
@ -289,7 +290,7 @@ Player::~Player() {
script->OnPlayerExit(zoneControl, this); script->OnPlayerExit(zoneControl, this);
} }
std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_SCRIPTED_ACTIVITY); std::vector<Entity*> scriptedActs = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SCRIPTED_ACTIVITY);
for (Entity* scriptEntity : scriptedActs) { for (Entity* scriptEntity : scriptedActs) {
if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds if (scriptEntity->GetObjectID() != zoneControl->GetObjectID()) { // Don't want to trigger twice on instance worlds
for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) { for (CppScripts::Script* script : CppScripts::GetEntityScripts(scriptEntity)) {

View File

@ -5,6 +5,7 @@
#include "dLogger.h" #include "dLogger.h"
#include "Game.h" #include "Game.h"
#include "dZoneManager.h" #include "dZoneManager.h"
#include "eServerDisconnectIdentifiers.h"
User::User(const SystemAddress& sysAddr, const std::string& username, const std::string& sessionKey) { User::User(const SystemAddress& sysAddr, const std::string& username, const std::string& sessionKey) {
m_AccountID = 0; m_AccountID = 0;
@ -126,6 +127,6 @@ void User::UserOutOfSync() {
if (m_AmountOfTimesOutOfSync > m_MaxDesyncAllowed) { if (m_AmountOfTimesOutOfSync > m_MaxDesyncAllowed) {
//YEET //YEET
Game::logger->Log("User", "User %s was out of sync %i times out of %i, disconnecting for suspected speedhacking.", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed); Game::logger->Log("User", "User %s was out of sync %i times out of %i, disconnecting for suspected speedhacking.", m_Username.c_str(), m_AmountOfTimesOutOfSync, m_MaxDesyncAllowed);
Game::server->Disconnect(this->m_SystemAddress, SERVER_DISCON_KICK); Game::server->Disconnect(this->m_SystemAddress, eServerDisconnectIdentifiers::PLAY_SCHEDULE_TIME_DONE);
} }
} }

View File

@ -73,13 +73,14 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "RenderComponent.h" #include "RenderComponent.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "CDBehaviorTemplateTable.h"
std::unordered_map<uint32_t, Behavior*> Behavior::Cache = {}; std::unordered_map<uint32_t, Behavior*> Behavior::Cache = {};
CDBehaviorParameterTable* Behavior::BehaviorParameterTable = nullptr; CDBehaviorParameterTable* Behavior::BehaviorParameterTable = nullptr;
Behavior* Behavior::GetBehavior(const uint32_t behaviorId) { Behavior* Behavior::GetBehavior(const uint32_t behaviorId) {
if (BehaviorParameterTable == nullptr) { if (BehaviorParameterTable == nullptr) {
BehaviorParameterTable = CDClientManager::Instance()->GetTable<CDBehaviorParameterTable>("BehaviorParameter"); BehaviorParameterTable = CDClientManager::Instance().GetTable<CDBehaviorParameterTable>();
} }
const auto pair = Cache.find(behaviorId); const auto pair = Cache.find(behaviorId);
@ -290,7 +291,7 @@ Behavior* Behavior::CreateBehavior(const uint32_t behaviorId) {
} }
BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) { BehaviorTemplates Behavior::GetBehaviorTemplate(const uint32_t behaviorId) {
auto behaviorTemplateTable = CDClientManager::Instance()->GetTable<CDBehaviorTemplateTable>("BehaviorTemplate"); auto behaviorTemplateTable = CDClientManager::Instance().GetTable<CDBehaviorTemplateTable>();
BehaviorTemplates templateID = BehaviorTemplates::BEHAVIOR_EMPTY; BehaviorTemplates templateID = BehaviorTemplates::BEHAVIOR_EMPTY;
// Find behavior template by its behavior id. Default to 0. // Find behavior template by its behavior id. Default to 0.
@ -398,7 +399,7 @@ void Behavior::PlayFx(std::u16string type, const LWOOBJID target, const LWOOBJID
} }
Behavior::Behavior(const uint32_t behaviorId) { Behavior::Behavior(const uint32_t behaviorId) {
auto behaviorTemplateTable = CDClientManager::Instance()->GetTable<CDBehaviorTemplateTable>("BehaviorTemplate"); auto behaviorTemplateTable = CDClientManager::Instance().GetTable<CDBehaviorTemplateTable>();
CDBehaviorTemplate templateInDatabase{}; CDBehaviorTemplate templateInDatabase{};
@ -441,7 +442,7 @@ Behavior::Behavior(const uint32_t behaviorId) {
float Behavior::GetFloat(const std::string& name, const float defaultValue) const { float Behavior::GetFloat(const std::string& name, const float defaultValue) const {
// Get the behavior parameter entry and return its value. // Get the behavior parameter entry and return its value.
if (!BehaviorParameterTable) BehaviorParameterTable = CDClientManager::Instance()->GetTable<CDBehaviorParameterTable>("BehaviorParameter"); if (!BehaviorParameterTable) BehaviorParameterTable = CDClientManager::Instance().GetTable<CDBehaviorParameterTable>();
return BehaviorParameterTable->GetValue(this->m_behaviorId, name, defaultValue); return BehaviorParameterTable->GetValue(this->m_behaviorId, name, defaultValue);
} }
@ -469,7 +470,7 @@ Behavior* Behavior::GetAction(float value) const {
std::map<std::string, float> Behavior::GetParameterNames() const { std::map<std::string, float> Behavior::GetParameterNames() const {
std::map<std::string, float> templatesInDatabase; std::map<std::string, float> templatesInDatabase;
// Find behavior template by its behavior id. // Find behavior template by its behavior id.
if (!BehaviorParameterTable) BehaviorParameterTable = CDClientManager::Instance()->GetTable<CDBehaviorParameterTable>("BehaviorParameter"); if (!BehaviorParameterTable) BehaviorParameterTable = CDClientManager::Instance().GetTable<CDBehaviorParameterTable>();
if (BehaviorParameterTable) { if (BehaviorParameterTable) {
templatesInDatabase = BehaviorParameterTable->GetParametersByBehaviorID(this->m_behaviorId); templatesInDatabase = BehaviorParameterTable->GetParametersByBehaviorID(this->m_behaviorId);
} }

View File

@ -15,6 +15,7 @@
#include "EchoSyncSkill.h" #include "EchoSyncSkill.h"
#include "PhantomPhysicsComponent.h" #include "PhantomPhysicsComponent.h"
#include "RebuildComponent.h" #include "RebuildComponent.h"
#include "eReplicaComponentType.h"
BehaviorSyncEntry::BehaviorSyncEntry() { BehaviorSyncEntry::BehaviorSyncEntry() {
} }
@ -311,13 +312,13 @@ std::vector<LWOOBJID> BehaviorContext::GetValidTargets(int32_t ignoreFaction, in
} }
} }
if (ignoreFaction || includeFaction || (!entity->HasComponent(COMPONENT_TYPE_PHANTOM_PHYSICS) && targets.empty())) { if (ignoreFaction || includeFaction || (!entity->HasComponent(eReplicaComponentType::PHANTOM_PHYSICS) && targets.empty())) {
DestroyableComponent* destroyableComponent; DestroyableComponent* destroyableComponent;
if (!entity->TryGetComponent(COMPONENT_TYPE_DESTROYABLE, destroyableComponent)) { if (!entity->TryGetComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent)) {
return targets; return targets;
} }
auto entities = EntityManager::Instance()->GetEntitiesByComponent(COMPONENT_TYPE_CONTROLLABLE_PHYSICS); auto entities = EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::CONTROLLABLE_PHYSICS);
for (auto* candidate : entities) { for (auto* candidate : entities) {
const auto id = candidate->GetObjectID(); const auto id = candidate->GetObjectID();

View File

@ -4,6 +4,7 @@
#include "dLogger.h" #include "dLogger.h"
#include "EntityManager.h" #include "EntityManager.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
@ -15,7 +16,7 @@ void HealBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_strea
return; return;
} }
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE)); auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
if (destroyable == nullptr) { if (destroyable == nullptr) {
Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target); Game::logger->Log("HealBehavior", "Failed to find destroyable component for %(llu)!", branch.target);

View File

@ -9,6 +9,8 @@
#include "CDClientDatabase.h" #include "CDClientDatabase.h"
#include "CDClientManager.h" #include "CDClientManager.h"
#include "CDSkillBehaviorTable.h"
void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void OverTimeBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
const auto originator = context->originator; const auto originator = context->originator;
@ -39,7 +41,7 @@ void OverTimeBehavior::Load() {
m_Action = GetInt("action"); m_Action = GetInt("action");
// Since m_Action is a skillID and not a behavior, get is correlated behaviorID. // Since m_Action is a skillID and not a behavior, get is correlated behaviorID.
CDSkillBehaviorTable* skillTable = CDClientManager::Instance()->GetTable<CDSkillBehaviorTable>("SkillBehavior"); CDSkillBehaviorTable* skillTable = CDClientManager::Instance().GetTable<CDSkillBehaviorTable>();
m_ActionBehaviorId = skillTable->GetSkillByID(m_Action).behaviorID; m_ActionBehaviorId = skillTable->GetSkillByID(m_Action).behaviorID;
m_Delay = GetFloat("delay"); m_Delay = GetFloat("delay");

View File

@ -5,6 +5,7 @@
#include "EntityManager.h" #include "EntityManager.h"
#include "dLogger.h" #include "dLogger.h"
#include "Game.h" #include "Game.h"
#include "eReplicaComponentType.h"
void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) { void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_stream, const BehaviorBranchContext branch) {
auto* entity = EntityManager::Instance()->GetEntity(branch.target); auto* entity = EntityManager::Instance()->GetEntity(branch.target);
@ -15,7 +16,7 @@ void RepairBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bit_str
return; return;
} }
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE)); auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
if (destroyable == nullptr) { if (destroyable == nullptr) {
Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target); Game::logger->Log("RepairBehavior", "Failed to find destroyable component for %(llu)!", branch.target);

View File

@ -9,6 +9,7 @@
#include "RebuildComponent.h" #include "RebuildComponent.h"
#include "Entity.h" #include "Entity.h"
#include "EntityInfo.h" #include "EntityInfo.h"
#include "eReplicaComponentType.h"
void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) { void SpawnBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, BehaviorBranchContext branch) {
auto* origin = EntityManager::Instance()->GetEntity(context->originator); auto* origin = EntityManager::Instance()->GetEntity(context->originator);
@ -86,7 +87,7 @@ void SpawnBehavior::Timer(BehaviorContext* context, const BehaviorBranchContext
return; return;
} }
auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(COMPONENT_TYPE_DESTROYABLE)); auto* destroyable = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
if (destroyable == nullptr) { if (destroyable == nullptr) {
entity->Smash(context->originator); entity->Smash(context->originator);

View File

@ -7,6 +7,7 @@
#include "Game.h" #include "Game.h"
#include "dLogger.h" #include "dLogger.h"
#include "DestroyableComponent.h" #include "DestroyableComponent.h"
#include "eReplicaComponentType.h"
void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) { void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream, const BehaviorBranchContext branch) {
@ -32,7 +33,7 @@ void StunBehavior::Handle(BehaviorContext* context, RakNet::BitStream* bitStream
* If our target is an enemy we can go ahead and stun it. * If our target is an enemy we can go ahead and stun it.
*/ */
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI)); auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
if (combatAiComponent == nullptr) { if (combatAiComponent == nullptr) {
return; return;
@ -55,7 +56,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
* See if we can stun ourselves * See if we can stun ourselves
*/ */
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI)); auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(self->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
if (combatAiComponent == nullptr) { if (combatAiComponent == nullptr) {
return; return;
@ -90,7 +91,7 @@ void StunBehavior::Calculate(BehaviorContext* context, RakNet::BitStream* bitStr
* If our target is an enemy we can go ahead and stun it. * If our target is an enemy we can go ahead and stun it.
*/ */
auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(COMPONENT_TYPE_BASE_COMBAT_AI)); auto* combatAiComponent = static_cast<BaseCombatAIComponent*>(target->GetComponent(eReplicaComponentType::BASE_COMBAT_AI));
if (combatAiComponent == nullptr) { if (combatAiComponent == nullptr) {
return; return;

Some files were not shown because too many files have changed in this diff Show More