mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-23 15:22:28 +00:00
Character fixes - get it compiling again
- Pass componentID to activity component constructor - use int componentid so -1 can denote no component
This commit is contained in:
parent
d9a3bea6d5
commit
2abcb142ad
@ -29,8 +29,8 @@
|
|||||||
#include "CDActivitiesTable.h"
|
#include "CDActivitiesTable.h"
|
||||||
#include "LeaderboardManager.h"
|
#include "LeaderboardManager.h"
|
||||||
|
|
||||||
ActivityComponent::ActivityComponent(Entity* parent) : Component(parent) {
|
ActivityComponent::ActivityComponent(Entity* parent, int32_t componentId) : Component(parent) {
|
||||||
m_ActivityID = activityID;
|
m_ActivityID = componentId;
|
||||||
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
CDActivitiesTable* activitiesTable = CDClientManager::Instance().GetTable<CDActivitiesTable>();
|
||||||
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
std::vector<CDActivities> activities = activitiesTable->Query([=](CDActivities entry) {return (entry.ActivityID == m_ActivityID); });
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ struct ActivityPlayer {
|
|||||||
*/
|
*/
|
||||||
class ActivityComponent : public Component {
|
class ActivityComponent : public Component {
|
||||||
public:
|
public:
|
||||||
ActivityComponent(Entity* parent);
|
ActivityComponent(Entity* parent, int32_t componentId);
|
||||||
~ActivityComponent() override;
|
~ActivityComponent() override;
|
||||||
|
|
||||||
void Update(float deltaTime) override;
|
void Update(float deltaTime) override;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
/**
|
/**
|
||||||
* Component for the build border, allowing the user to start building when interacting with it
|
* Component for the build border, allowing the user to start building when interacting with it
|
||||||
*/
|
*/
|
||||||
class BuildBorderComponent : public Component {
|
class BuildBorderComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::BUILD_BORDER;
|
||||||
|
|
||||||
|
@ -66,16 +66,12 @@ bool CharacterComponent::LandingAnimDisabled(int zoneID) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CharacterComponent::~CharacterComponent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||||
|
|
||||||
if (bIsInitialUpdate) {
|
if (bIsInitialUpdate) {
|
||||||
outBitStream->Write0();
|
outBitStream->Write0(); // Claim codes. Dont't belive these have an effect.
|
||||||
outBitStream->Write0();
|
outBitStream->Write0(); // Claim codes. Dont't belive these have an effect.
|
||||||
outBitStream->Write0();
|
outBitStream->Write0(); // Claim codes. Dont't belive these have an effect.
|
||||||
outBitStream->Write0();
|
outBitStream->Write0(); // Claim codes. Dont't belive these have an effect.
|
||||||
|
|
||||||
outBitStream->Write(m_Character->GetHairColor());
|
outBitStream->Write(m_Character->GetHairColor());
|
||||||
outBitStream->Write(m_Character->GetHairStyle());
|
outBitStream->Write(m_Character->GetHairStyle());
|
||||||
@ -122,6 +118,8 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
|
|||||||
outBitStream->Write(m_RacesFinished);
|
outBitStream->Write(m_RacesFinished);
|
||||||
outBitStream->Write(m_FirstPlaceRaceFinishes);
|
outBitStream->Write(m_FirstPlaceRaceFinishes);
|
||||||
|
|
||||||
|
// This is a really weird bit of serialization. This is serialized as a two bit integer, but the first bit written is always zero.
|
||||||
|
// If the 2 bit integer is exactly 1, we write the rocket configuration.
|
||||||
outBitStream->Write0();
|
outBitStream->Write0();
|
||||||
outBitStream->Write(m_IsLanding);
|
outBitStream->Write(m_IsLanding);
|
||||||
if (m_IsLanding) {
|
if (m_IsLanding) {
|
||||||
@ -132,20 +130,24 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
outBitStream->Write(m_DirtyGMInfo);
|
outBitStream->Write(bIsInitialUpdate || m_DirtyGMInfo);
|
||||||
if (m_DirtyGMInfo) {
|
if (bIsInitialUpdate || m_DirtyGMInfo) {
|
||||||
outBitStream->Write(m_PvpEnabled);
|
outBitStream->Write(m_PvpEnabled);
|
||||||
outBitStream->Write(m_IsGM);
|
outBitStream->Write(m_IsGM);
|
||||||
outBitStream->Write(m_GMLevel);
|
outBitStream->Write(m_GMLevel);
|
||||||
outBitStream->Write(m_EditorEnabled);
|
outBitStream->Write(m_EditorEnabled);
|
||||||
outBitStream->Write(m_EditorLevel);
|
outBitStream->Write(m_EditorLevel);
|
||||||
|
if (!bIsInitialUpdate) m_DirtyGMInfo = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
outBitStream->Write(m_DirtyCurrentActivity);
|
outBitStream->Write(bIsInitialUpdate || m_DirtyCurrentActivity);
|
||||||
if (m_DirtyCurrentActivity) outBitStream->Write(m_CurrentActivity);
|
if (bIsInitialUpdate || m_DirtyCurrentActivity) {
|
||||||
|
outBitStream->Write(m_CurrentActivity);
|
||||||
|
if (!bIsInitialUpdate) m_DirtyCurrentActivity = false;
|
||||||
|
}
|
||||||
|
|
||||||
outBitStream->Write(m_DirtySocialInfo);
|
outBitStream->Write(bIsInitialUpdate || m_DirtySocialInfo);
|
||||||
if (m_DirtySocialInfo) {
|
if (bIsInitialUpdate || m_DirtySocialInfo) {
|
||||||
outBitStream->Write(m_GuildID);
|
outBitStream->Write(m_GuildID);
|
||||||
outBitStream->Write<unsigned char>(static_cast<unsigned char>(m_GuildName.size()));
|
outBitStream->Write<unsigned char>(static_cast<unsigned char>(m_GuildName.size()));
|
||||||
if (!m_GuildName.empty())
|
if (!m_GuildName.empty())
|
||||||
@ -153,6 +155,7 @@ void CharacterComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInit
|
|||||||
|
|
||||||
outBitStream->Write(m_IsLEGOClubMember);
|
outBitStream->Write(m_IsLEGOClubMember);
|
||||||
outBitStream->Write(m_CountryCode);
|
outBitStream->Write(m_CountryCode);
|
||||||
|
if (!bIsInitialUpdate) m_DirtySocialInfo = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,21 +164,21 @@ bool CharacterComponent::GetPvpEnabled() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::SetPvpEnabled(const bool value) {
|
void CharacterComponent::SetPvpEnabled(const bool value) {
|
||||||
|
if (m_PvpEnabled == value) return;
|
||||||
m_DirtyGMInfo = true;
|
m_DirtyGMInfo = true;
|
||||||
|
|
||||||
m_PvpEnabled = value;
|
m_PvpEnabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::SetGMLevel(eGameMasterLevel gmlevel) {
|
void CharacterComponent::SetGMLevel(eGameMasterLevel gmlevel) {
|
||||||
|
if (m_GMLevel == gmlevel) return;
|
||||||
m_DirtyGMInfo = true;
|
m_DirtyGMInfo = true;
|
||||||
if (gmlevel > eGameMasterLevel::CIVILIAN) m_IsGM = true;
|
m_IsGM = gmlevel > eGameMasterLevel::CIVILIAN;
|
||||||
else m_IsGM = false;
|
|
||||||
m_GMLevel = gmlevel;
|
m_GMLevel = gmlevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
||||||
|
auto* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!");
|
Game::logger->Log("CharacterComponent", "Failed to find char tag while loading XML!");
|
||||||
return;
|
return;
|
||||||
@ -195,7 +198,7 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the zone statistics
|
// Load the zone statistics
|
||||||
m_ZoneStatistics = {};
|
m_ZoneStatistics.clear();
|
||||||
auto zoneStatistics = character->FirstChildElement("zs");
|
auto zoneStatistics = character->FirstChildElement("zs");
|
||||||
|
|
||||||
if (zoneStatistics) {
|
if (zoneStatistics) {
|
||||||
@ -218,20 +221,16 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const tinyxml2::XMLAttribute* rocketConfig = character->FindAttribute("lcbp");
|
const auto* rocketConfig = character->FindAttribute("lcbp");
|
||||||
|
|
||||||
if (rocketConfig) {
|
m_LastRocketConfig = rocketConfig ? GeneralUtils::ASCIIToUTF16(rocketConfig->Value()) : u"";
|
||||||
m_LastRocketConfig = GeneralUtils::ASCIIToUTF16(rocketConfig->Value());
|
|
||||||
} else {
|
|
||||||
m_LastRocketConfig = u"";
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Begin custom attributes
|
// Begin custom attributes
|
||||||
//
|
//
|
||||||
|
|
||||||
// Load the last rocket item ID
|
// Load the last rocket item ID
|
||||||
const tinyxml2::XMLAttribute* lastRocketItemID = character->FindAttribute("lrid");
|
const auto* lastRocketItemID = character->FindAttribute("lrid");
|
||||||
if (lastRocketItemID) {
|
if (lastRocketItemID) {
|
||||||
m_LastRocketItemID = lastRocketItemID->Int64Value();
|
m_LastRocketItemID = lastRocketItemID->Int64Value();
|
||||||
}
|
}
|
||||||
@ -244,11 +243,11 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
m_IsGM = true;
|
m_IsGM = true;
|
||||||
m_DirtyGMInfo = true;
|
m_DirtyGMInfo = true;
|
||||||
m_EditorLevel = m_GMLevel;
|
m_EditorLevel = m_GMLevel;
|
||||||
m_EditorEnabled = false; //We're not currently in HF if we're loading in
|
m_EditorEnabled = false; // We're not currently in HF if we're loading in
|
||||||
}
|
}
|
||||||
|
|
||||||
//Annoying guild bs:
|
//Annoying guild bs:
|
||||||
const tinyxml2::XMLAttribute* guildName = character->FindAttribute("gn");
|
const auto* guildName = character->FindAttribute("gn");
|
||||||
if (guildName) {
|
if (guildName) {
|
||||||
const char* gn = guildName->Value();
|
const char* gn = guildName->Value();
|
||||||
int64_t gid = 0;
|
int64_t gid = 0;
|
||||||
@ -269,10 +268,8 @@ void CharacterComponent::LoadFromXml(tinyxml2::XMLDocument* doc) {
|
|||||||
|
|
||||||
if (!m_Character) return;
|
if (!m_Character) return;
|
||||||
|
|
||||||
//Check to see if we're landing:
|
// If the loaded zoneID is different from the current zoneID, we are landing
|
||||||
if (m_Character->GetZoneID() != Game::server->GetZoneID()) {
|
m_IsLanding = m_Character->GetZoneID() != Game::server->GetZoneID();
|
||||||
m_IsLanding = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (LandingAnimDisabled(m_Character->GetZoneID()) || LandingAnimDisabled(Game::server->GetZoneID()) || m_LastRocketConfig.empty()) {
|
if (LandingAnimDisabled(m_Character->GetZoneID()) || LandingAnimDisabled(Game::server->GetZoneID()) || m_LastRocketConfig.empty()) {
|
||||||
m_IsLanding = false; //Don't make us land on VE/minigames lol
|
m_IsLanding = false; //Don't make us land on VE/minigames lol
|
||||||
@ -300,7 +297,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
|
|
||||||
// done with minifig
|
// done with minifig
|
||||||
|
|
||||||
tinyxml2::XMLElement* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
auto* character = doc->FirstChildElement("obj")->FirstChildElement("char");
|
||||||
if (!character) {
|
if (!character) {
|
||||||
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!");
|
Game::logger->Log("CharacterComponent", "Failed to find char tag while updating XML!");
|
||||||
return;
|
return;
|
||||||
@ -316,15 +313,15 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
if (!zoneStatistics) zoneStatistics = doc->NewElement("zs");
|
if (!zoneStatistics) zoneStatistics = doc->NewElement("zs");
|
||||||
zoneStatistics->DeleteChildren();
|
zoneStatistics->DeleteChildren();
|
||||||
|
|
||||||
for (auto pair : m_ZoneStatistics) {
|
for (const auto&[mapId, zoneStatisticToSave] : m_ZoneStatistics) {
|
||||||
auto zoneStatistic = doc->NewElement("s");
|
auto zoneStatistic = doc->NewElement("s");
|
||||||
|
|
||||||
zoneStatistic->SetAttribute("map", pair.first);
|
zoneStatistic->SetAttribute("map", mapId);
|
||||||
zoneStatistic->SetAttribute("ac", pair.second.m_AchievementsCollected);
|
zoneStatistic->SetAttribute("ac", zoneStatisticToSave.m_AchievementsCollected);
|
||||||
zoneStatistic->SetAttribute("bc", pair.second.m_BricksCollected);
|
zoneStatistic->SetAttribute("bc", zoneStatisticToSave.m_BricksCollected);
|
||||||
zoneStatistic->SetAttribute("cc", pair.second.m_CoinsCollected);
|
zoneStatistic->SetAttribute("cc", zoneStatisticToSave.m_CoinsCollected);
|
||||||
zoneStatistic->SetAttribute("es", pair.second.m_EnemiesSmashed);
|
zoneStatistic->SetAttribute("es", zoneStatisticToSave.m_EnemiesSmashed);
|
||||||
zoneStatistic->SetAttribute("qbc", pair.second.m_QuickBuildsCompleted);
|
zoneStatistic->SetAttribute("qbc", zoneStatisticToSave.m_QuickBuildsCompleted);
|
||||||
|
|
||||||
zoneStatistics->LinkEndChild(zoneStatistic);
|
zoneStatistics->LinkEndChild(zoneStatistic);
|
||||||
}
|
}
|
||||||
@ -350,7 +347,7 @@ void CharacterComponent::UpdateXml(tinyxml2::XMLDocument* doc) {
|
|||||||
//
|
//
|
||||||
|
|
||||||
auto newUpdateTimestamp = std::time(nullptr);
|
auto newUpdateTimestamp = std::time(nullptr);
|
||||||
Game::logger->Log("TotalTimePlayed", "Time since last save: %d", newUpdateTimestamp - m_LastUpdateTimestamp);
|
Game::logger->Log("TotalTimePlayed", "Time since %i last saved: %d", m_Character->GetID(), newUpdateTimestamp - m_LastUpdateTimestamp);
|
||||||
|
|
||||||
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
|
m_TotalTimePlayed += newUpdateTimestamp - m_LastUpdateTimestamp;
|
||||||
character->SetAttribute("time", m_TotalTimePlayed);
|
character->SetAttribute("time", m_TotalTimePlayed);
|
||||||
@ -391,7 +388,7 @@ Item* CharacterComponent::RocketEquip(Entity* player) {
|
|||||||
if (!rocket) return rocket;
|
if (!rocket) return rocket;
|
||||||
|
|
||||||
// build and define the rocket config
|
// build and define the rocket config
|
||||||
for (LDFBaseData* data : rocket->GetConfig()) {
|
for (auto* data : rocket->GetConfig()) {
|
||||||
if (data->GetKey() == u"assemblyPartLOTs") {
|
if (data->GetKey() == u"assemblyPartLOTs") {
|
||||||
std::string newRocketStr = data->GetValueAsString() + ";";
|
std::string newRocketStr = data->GetValueAsString() + ";";
|
||||||
GeneralUtils::ReplaceInString(newRocketStr, "+", ";");
|
GeneralUtils::ReplaceInString(newRocketStr, "+", ";");
|
||||||
@ -471,9 +468,7 @@ void CharacterComponent::TrackImaginationDelta(int32_t imagination) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::TrackArmorDelta(int32_t armor) {
|
void CharacterComponent::TrackArmorDelta(int32_t armor) {
|
||||||
if (armor > 0) {
|
if (armor > 0) UpdatePlayerStatistic(TotalArmorRepaired, armor);
|
||||||
UpdatePlayerStatistic(TotalArmorRepaired, armor);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::TrackRebuildComplete() {
|
void CharacterComponent::TrackRebuildComplete() {
|
||||||
@ -485,17 +480,16 @@ void CharacterComponent::TrackRebuildComplete() {
|
|||||||
|
|
||||||
void CharacterComponent::TrackRaceCompleted(bool won) {
|
void CharacterComponent::TrackRaceCompleted(bool won) {
|
||||||
m_RacesFinished++;
|
m_RacesFinished++;
|
||||||
if (won)
|
if (won) m_FirstPlaceRaceFinishes++;
|
||||||
m_FirstPlaceRaceFinishes++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterComponent::TrackPositionUpdate(const NiPoint3& newPosition) {
|
void CharacterComponent::TrackPositionUpdate(const NiPoint3& newPosition) {
|
||||||
const auto distance = NiPoint3::Distance(newPosition, m_ParentEntity->GetPosition());
|
const auto distance = NiPoint3::Distance(newPosition, m_ParentEntity->GetPosition());
|
||||||
|
|
||||||
if (m_IsRacing) {
|
if (m_IsRacing) {
|
||||||
UpdatePlayerStatistic(DistanceDriven, (uint64_t)distance);
|
UpdatePlayerStatistic(DistanceDriven, static_cast<uint64_t>(distance));
|
||||||
} else {
|
} else {
|
||||||
UpdatePlayerStatistic(MetersTraveled, (uint64_t)distance);
|
UpdatePlayerStatistic(MetersTraveled, static_cast<uint64_t>(distance));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -666,45 +660,45 @@ void CharacterComponent::InitializeEmptyStatistics() {
|
|||||||
|
|
||||||
std::string CharacterComponent::StatisticsToString() const {
|
std::string CharacterComponent::StatisticsToString() const {
|
||||||
std::stringstream result;
|
std::stringstream result;
|
||||||
result << std::to_string(m_CurrencyCollected) << ';'
|
result
|
||||||
<< std::to_string(m_BricksCollected) << ';'
|
<< m_CurrencyCollected << ';'
|
||||||
<< std::to_string(m_SmashablesSmashed) << ';'
|
<< m_BricksCollected << ';'
|
||||||
<< std::to_string(m_QuickBuildsCompleted) << ';'
|
<< m_SmashablesSmashed << ';'
|
||||||
<< std::to_string(m_EnemiesSmashed) << ';'
|
<< m_QuickBuildsCompleted << ';'
|
||||||
<< std::to_string(m_RocketsUsed) << ';'
|
<< m_EnemiesSmashed << ';'
|
||||||
<< std::to_string(m_MissionsCompleted) << ';'
|
<< m_RocketsUsed << ';'
|
||||||
<< std::to_string(m_PetsTamed) << ';'
|
<< m_MissionsCompleted << ';'
|
||||||
<< std::to_string(m_ImaginationPowerUpsCollected) << ';'
|
<< m_PetsTamed << ';'
|
||||||
<< std::to_string(m_LifePowerUpsCollected) << ';'
|
<< m_ImaginationPowerUpsCollected << ';'
|
||||||
<< std::to_string(m_ArmorPowerUpsCollected) << ';'
|
<< m_LifePowerUpsCollected << ';'
|
||||||
<< std::to_string(m_MetersTraveled) << ';'
|
<< m_ArmorPowerUpsCollected << ';'
|
||||||
<< std::to_string(m_TimesSmashed) << ';'
|
<< m_MetersTraveled << ';'
|
||||||
<< std::to_string(m_TotalDamageTaken) << ';'
|
<< m_TimesSmashed << ';'
|
||||||
<< std::to_string(m_TotalDamageHealed) << ';'
|
<< m_TotalDamageTaken << ';'
|
||||||
<< std::to_string(m_TotalArmorRepaired) << ';'
|
<< m_TotalDamageHealed << ';'
|
||||||
<< std::to_string(m_TotalImaginationRestored) << ';'
|
<< m_TotalArmorRepaired << ';'
|
||||||
<< std::to_string(m_TotalImaginationUsed) << ';'
|
<< m_TotalImaginationRestored << ';'
|
||||||
<< std::to_string(m_DistanceDriven) << ';'
|
<< m_TotalImaginationUsed << ';'
|
||||||
<< std::to_string(m_TimeAirborneInCar) << ';'
|
<< m_DistanceDriven << ';'
|
||||||
<< std::to_string(m_RacingImaginationPowerUpsCollected) << ';'
|
<< m_TimeAirborneInCar << ';'
|
||||||
<< std::to_string(m_RacingImaginationCratesSmashed) << ';'
|
<< m_RacingImaginationPowerUpsCollected << ';'
|
||||||
<< std::to_string(m_RacingCarBoostsActivated) << ';'
|
<< m_RacingImaginationCratesSmashed << ';'
|
||||||
<< std::to_string(m_RacingTimesWrecked) << ';'
|
<< m_RacingCarBoostsActivated << ';'
|
||||||
<< std::to_string(m_RacingSmashablesSmashed) << ';'
|
<< m_RacingTimesWrecked << ';'
|
||||||
<< std::to_string(m_RacesFinished) << ';'
|
<< m_RacingSmashablesSmashed << ';'
|
||||||
<< std::to_string(m_FirstPlaceRaceFinishes) << ';';
|
<< m_RacesFinished << ';'
|
||||||
|
<< m_FirstPlaceRaceFinishes << ';';
|
||||||
|
|
||||||
return result.str();
|
return result.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t CharacterComponent::GetStatisticFromSplit(std::vector<std::string> split, uint32_t index) {
|
uint64_t CharacterComponent::GetStatisticFromSplit(std::vector<std::string> split, uint32_t index) {
|
||||||
return split.size() > index ? std::stoul(split.at(index)) : 0;
|
return index < split.size() ? std::stoul(split.at(index)) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZoneStatistics& CharacterComponent::GetZoneStatisticsForMap(LWOMAPID mapID) {
|
ZoneStatistics& CharacterComponent::GetZoneStatisticsForMap(LWOMAPID mapID) {
|
||||||
auto stats = m_ZoneStatistics.find(mapID);
|
auto stats = m_ZoneStatistics.find(mapID);
|
||||||
if (stats == m_ZoneStatistics.end())
|
if (stats == m_ZoneStatistics.end()) m_ZoneStatistics.insert({ mapID, {0, 0, 0, 0, 0 } });
|
||||||
m_ZoneStatistics.insert({ mapID, {0, 0, 0, 0, 0 } });
|
|
||||||
return m_ZoneStatistics.at(mapID);
|
return m_ZoneStatistics.at(mapID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,11 @@ enum StatisticID {
|
|||||||
/**
|
/**
|
||||||
* Represents a character, including their rockets and stats
|
* Represents a character, including their rockets and stats
|
||||||
*/
|
*/
|
||||||
class CharacterComponent : public Component {
|
class CharacterComponent final : public Component {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::CHARACTER;
|
||||||
|
|
||||||
CharacterComponent(Entity* parent, Character* character);
|
CharacterComponent(Entity* parent, Character* character);
|
||||||
~CharacterComponent() override;
|
|
||||||
|
|
||||||
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
void LoadFromXml(tinyxml2::XMLDocument* doc) override;
|
||||||
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
void UpdateXml(tinyxml2::XMLDocument* doc) override;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "GateRushComponent.h"
|
#include "GateRushComponent.h"
|
||||||
|
|
||||||
GateRushComponent::GateRushComponent(Entity* parent) : RacingControlComponent(parent) {
|
GateRushComponent::GateRushComponent(Entity* parent, int32_t componentId) : RacingControlComponent(parent, componentId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ class Entity;
|
|||||||
class GateRushComponent : public RacingControlComponent {
|
class GateRushComponent : public RacingControlComponent {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::GATE_RUSH_CONTROL;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::GATE_RUSH_CONTROL;
|
||||||
GateRushComponent(Entity* parent);
|
GateRushComponent(Entity* parent, int32_t componentId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__GATERUSHCONTROLCOMPONENT__H__
|
#endif //!__GATERUSHCONTROLCOMPONENT__H__
|
||||||
|
@ -2,6 +2,6 @@
|
|||||||
#include "Entity.h"
|
#include "Entity.h"
|
||||||
#include "MinigameControlComponent.h"
|
#include "MinigameControlComponent.h"
|
||||||
|
|
||||||
MinigameControlComponent::MinigameControlComponent(Entity* parent) : ActivityComponent(parent) {
|
MinigameControlComponent::MinigameControlComponent(Entity* parent, int32_t componentId) : ActivityComponent(parent, componentId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ class Entity;
|
|||||||
class MinigameControlComponent : public ActivityComponent {
|
class MinigameControlComponent : public ActivityComponent {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MINIGAME_CONTROL;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::MINIGAME_CONTROL;
|
||||||
MinigameControlComponent(Entity* parent);
|
MinigameControlComponent(Entity* parent, int32_t componentId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__MINIGAMECONTROLCOMPONENT__H__
|
#endif //!__MINIGAMECONTROLCOMPONENT__H__
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "CppScripts.h"
|
#include "CppScripts.h"
|
||||||
|
|
||||||
QuickBuildComponent::QuickBuildComponent(Entity* entity) : ActivityComponent(entity) {
|
QuickBuildComponent::QuickBuildComponent(Entity* entity, int32_t componentId) : ActivityComponent(entity, componentId) {
|
||||||
m_ComponentId = componentId;
|
m_ComponentId = componentId;
|
||||||
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
|
std::u16string checkPreconditions = entity->GetVar<std::u16string>(u"CheckPrecondition");
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class QuickBuildComponent : public ActivityComponent {
|
|||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::QUICK_BUILD;
|
||||||
|
|
||||||
QuickBuildComponent(Entity* entity, uint32_t componentId = 0);
|
QuickBuildComponent(Entity* entity, int32_t componentId = 0);
|
||||||
~QuickBuildComponent() override;
|
~QuickBuildComponent() override;
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||||
@ -351,7 +351,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
PreconditionExpression* m_Precondition = nullptr;
|
PreconditionExpression* m_Precondition = nullptr;
|
||||||
|
|
||||||
uint32_t m_ComponentId = 0;
|
int32_t m_ComponentId = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the rebuild for a certain entity
|
* Starts the rebuild for a certain entity
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "RacingComponent.h"
|
#include "RacingComponent.h"
|
||||||
|
|
||||||
RacingComponent::RacingComponent(Entity* parent) : RacingControlComponent(parent) {
|
RacingComponent::RacingComponent(Entity* parent, int32_t componentId) : RacingControlComponent(parent, componentId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ class Entity;
|
|||||||
class RacingComponent : public RacingControlComponent {
|
class RacingComponent : public RacingControlComponent {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
||||||
RacingComponent(Entity* parent);
|
RacingComponent(Entity* parent, int32_t componentId);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#define M_PI 3.14159265358979323846264338327950288
|
#define M_PI 3.14159265358979323846264338327950288
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RacingControlComponent::RacingControlComponent(Entity* parent) : ScriptedActivityComponent(parent) {
|
RacingControlComponent::RacingControlComponent(Entity* parent, int32_t componentId) : ScriptedActivityComponent(parent, componentId) {
|
||||||
m_PathName = u"MainPath";
|
m_PathName = u"MainPath";
|
||||||
m_RemainingLaps = 3;
|
m_RemainingLaps = 3;
|
||||||
m_LeadingPlayer = LWOOBJID_EMPTY;
|
m_LeadingPlayer = LWOOBJID_EMPTY;
|
||||||
|
@ -107,7 +107,7 @@ class RacingControlComponent : public ScriptedActivityComponent {
|
|||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::RACING_CONTROL;
|
||||||
|
|
||||||
RacingControlComponent(Entity* parentEntity);
|
RacingControlComponent(Entity* parentEntity, int32_t componentId);
|
||||||
~RacingControlComponent();
|
~RacingControlComponent();
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#include "ScriptedActivityComponent.h"
|
#include "ScriptedActivityComponent.h"
|
||||||
|
|
||||||
ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent) : ActivityComponent(parent) {
|
ScriptedActivityComponent::ScriptedActivityComponent(Entity* parent, int32_t componentId) : ActivityComponent(parent, componentId) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ class Entity;
|
|||||||
class ScriptedActivityComponent : public ActivityComponent {
|
class ScriptedActivityComponent : public ActivityComponent {
|
||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SCRIPTED_ACTIVITY;
|
||||||
ScriptedActivityComponent(Entity* parent);
|
ScriptedActivityComponent(Entity* parent, int32_t componentId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //!__SCRIPTEDACTIVITYCOMPONENT__H__
|
#endif //!__SCRIPTEDACTIVITYCOMPONENT__H__
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#include "EntityManager.h"
|
#include "EntityManager.h"
|
||||||
#include "ScriptedActivityComponent.h"
|
#include "ScriptedActivityComponent.h"
|
||||||
|
|
||||||
ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent) : ActivityComponent(parent) {
|
ShootingGalleryComponent::ShootingGalleryComponent(Entity* parent, int32_t componentId) : ActivityComponent(parent, componentId) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ShootingGalleryComponent::~ShootingGalleryComponent() = default;
|
ShootingGalleryComponent::~ShootingGalleryComponent() = default;
|
||||||
|
@ -75,7 +75,7 @@ class ShootingGalleryComponent : public ActivityComponent {
|
|||||||
public:
|
public:
|
||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::SHOOTING_GALLERY;
|
||||||
|
|
||||||
explicit ShootingGalleryComponent(Entity* parent);
|
explicit ShootingGalleryComponent(Entity* parent, int32_t componentId);
|
||||||
~ShootingGalleryComponent();
|
~ShootingGalleryComponent();
|
||||||
void Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const;
|
void Serialize(RakNet::BitStream* outBitStream, bool isInitialUpdate, uint32_t& flags) const;
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ void Entity::Initialize() {
|
|||||||
AddComponent<InventoryComponent>();
|
AddComponent<InventoryComponent>();
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::SHOOTING_GALLERY:
|
case eReplicaComponentType::SHOOTING_GALLERY:
|
||||||
AddComponent<ShootingGalleryComponent>();
|
AddComponent<ShootingGalleryComponent>(componentId);
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
case eReplicaComponentType::RIGID_BODY_PHANTOM_PHYSICS:
|
||||||
if (hasPhysicsComponent) continue;
|
if (hasPhysicsComponent) continue;
|
||||||
@ -402,7 +402,7 @@ void Entity::Initialize() {
|
|||||||
AddComponent<SwitchComponent>();
|
AddComponent<SwitchComponent>();
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::MINIGAME_CONTROL:
|
case eReplicaComponentType::MINIGAME_CONTROL:
|
||||||
AddComponent<MinigameControlComponent>();
|
AddComponent<MinigameControlComponent>(componentId);
|
||||||
break;
|
break;
|
||||||
case eReplicaComponentType::BASE_COMBAT_AI: {
|
case eReplicaComponentType::BASE_COMBAT_AI: {
|
||||||
auto* baseCombatAiComponent = AddComponent<BaseCombatAIComponent>(componentId);
|
auto* baseCombatAiComponent = AddComponent<BaseCombatAIComponent>(componentId);
|
||||||
@ -556,7 +556,7 @@ void Entity::Initialize() {
|
|||||||
case eReplicaComponentType::PLAYER_FORCED_MOVEMENT:
|
case eReplicaComponentType::PLAYER_FORCED_MOVEMENT:
|
||||||
case eReplicaComponentType::CRAFTING:
|
case eReplicaComponentType::CRAFTING:
|
||||||
case eReplicaComponentType::LEVEL_PROGRESSION:
|
case eReplicaComponentType::LEVEL_PROGRESSION:
|
||||||
case eReplicaComponentType::POSSESSOR:
|
case eReplicaComponentType::POSSESSION:
|
||||||
case eReplicaComponentType::MOUNT_CONTROL:
|
case eReplicaComponentType::MOUNT_CONTROL:
|
||||||
case eReplicaComponentType::UNKNOWN_112:
|
case eReplicaComponentType::UNKNOWN_112:
|
||||||
case eReplicaComponentType::PROPERTY_PLAQUE:
|
case eReplicaComponentType::PROPERTY_PLAQUE:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user