diff --git a/dGame/Character.h b/dGame/Character.h index 2c88fd0d..03086de2 100644 --- a/dGame/Character.h +++ b/dGame/Character.h @@ -682,6 +682,9 @@ private: * NOTE: quick as there's no DB lookups */ void DoQuickXMLDataParse(); +public: + const decltype(m_PlayerFlags)& GetPlayerFlags() const { return m_PlayerFlags; } + const decltype(m_SessionFlags)& GetSessionFlags() const { return m_SessionFlags; } }; #endif // CHARACTER_H diff --git a/dGame/dComponents/CharacterComponent.cpp b/dGame/dComponents/CharacterComponent.cpp index bdcf7446..a4b72755 100644 --- a/dGame/dComponents/CharacterComponent.cpp +++ b/dGame/dComponents/CharacterComponent.cpp @@ -25,7 +25,7 @@ #include "MessageType/Game.h" #include -CharacterComponent::CharacterComponent(Entity* parent, const int32_t componentID, Character* character, const SystemAddress& systemAddress) : Component(parent, componentID) { +CharacterComponent::CharacterComponent(Entity* parent, Character* character, const SystemAddress& systemAddress) : Component(parent) { m_Character = character; m_IsRacing = false; @@ -84,6 +84,30 @@ bool CharacterComponent::OnGetObjectReportInfo(GameMessages::GameMsg& msg) { cmptType.PushDebug("Current Activity Type") = GeneralUtils::ToUnderlying(m_CurrentActivity); cmptType.PushDebug("Property Clone ID") = m_Character->GetPropertyCloneID(); + auto& flagCmptType = reportInfo.info->PushDebug("Player Flag"); + auto& allFlags = flagCmptType.PushDebug("All flags"); + + for (const auto& [id, flagChunk] : m_Character->GetPlayerFlags()) { + const auto base = id * 64; + auto flagChunkCopy = flagChunk; + for (int i = 0; i < 64; i++) { + if (static_cast(flagChunkCopy & 1)) { + const int32_t flagId = base + i; + std::stringstream stream; + stream << "Flag: " << flagId; + allFlags.PushDebug(stream.str()) = ""; + } + flagChunkCopy >>= 1; + } + } + + auto& sessionFlags = flagCmptType.PushDebug("Session Only Flags"); + for (const auto flagId : m_Character->GetSessionFlags()) { + std::stringstream stream; + stream << "Flag: " << flagId; + sessionFlags.PushDebug(stream.str()); + } + return true; } @@ -859,7 +883,7 @@ void CharacterComponent::SendToZone(LWOMAPID zoneId, LWOCLONEID cloneId) const { character->SetZoneID(zoneID); character->SetZoneInstance(zoneInstance); character->SetZoneClone(zoneClone); - + characterComponent->SetLastRocketConfig(u""); characterComponent->AddVisitedLevel(LWOZONEID(zoneID, LWOINSTANCEID_INVALID, zoneClone)); diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 72641d80..331ece5c 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -32,7 +32,7 @@ #include "StringifiedEnum.h" namespace { - std::set g_TestedMissions = {773, 774, 775, 776, 777}; // TODO Figure out why these missions are broken sometimes + std::set g_TestedMissions = { 773, 774, 775, 776, 777 }; // TODO Figure out why these missions are broken sometimes } Mission::Mission(MissionComponent* missionComponent, const uint32_t missionId) { @@ -87,6 +87,7 @@ void Mission::LoadFromXmlDone(const tinyxml2::XMLElement& element) { } void Mission::LoadFromXmlCur(const tinyxml2::XMLElement& element) { + const auto* const character = GetCharacter(); // Start custom XML if (element.Attribute("state") != nullptr) { m_State = static_cast(std::stoul(element.Attribute("state"))); @@ -126,6 +127,12 @@ void Mission::LoadFromXmlCur(const tinyxml2::XMLElement& element) { } curTask->SetUnique(uniques); + } else if (type == eMissionTaskType::PLAYER_FLAG) { + int32_t progress = 0; // Update the progress to not include session flags which are unset between logins + for (const auto flag : curTask->GetAllTargets()) { + if (character->GetPlayerFlag(flag)) progress++; + } + curTask->SetProgress(progress, false); } index++; @@ -453,7 +460,7 @@ void Mission::YieldRewards() { if (info.LegoScore > 0) { eLootSourceType lootSource = info.isMission ? eLootSourceType::MISSION : eLootSourceType::ACHIEVEMENT; if (levelComponent->GetLevel() >= Game::zoneManager->GetWorldConfig().levelCap) { - // Since the character is at the level cap we reward them with coins instead of UScore. + // If player is at the level cap and doesnt want to keep earning UScore at max level we convert it here. coinsToSend += info.LegoScore * Game::zoneManager->GetWorldConfig().levelCapCurrencyConversion; } else { characterComponent->SetUScore(characterComponent->GetUScore() + info.LegoScore);