fix: Don't only store properties visited as the cloneID

This commit is contained in:
Aaron Kimbre 2023-07-29 16:34:06 -05:00
parent 304af7922a
commit e167c2ac6c
6 changed files with 33 additions and 5 deletions

View File

@ -15,7 +15,9 @@ enum class eCharacterVersion : uint32_t {
// Fixes vault size value // Fixes vault size value
VAULT_SIZE, VAULT_SIZE,
// Fixes speed base value in level component // Fixes speed base value in level component
UP_TO_DATE, // will become SPEED_BASE SPEED_BASE,
// Fix Tracking of properties visited for achievements
UP_TO_DATE // Will become PROPERTIES_VISITED
}; };
#endif //!__ECHARACTERVERSION__H__ #endif //!__ECHARACTERVERSION__H__

View File

@ -620,3 +620,17 @@ bool MissionComponent::HasCollectible(int32_t collectibleID) {
bool MissionComponent::HasMission(uint32_t missionId) { bool MissionComponent::HasMission(uint32_t missionId) {
return GetMission(missionId) != nullptr; return GetMission(missionId) != nullptr;
} }
void MissionComponent::FixPropertyVistingMissions(){
auto missionIDsToCheck = {1199, 1200, 1201, 1202, 1739};
for (auto& missionID : missionIDsToCheck){
auto mission = GetMission(missionID);
if (!mission || mission->GetMissionState() == eMissionState::COMPLETE) continue;
auto tasks = mission->GetTasks();
if (tasks.empty()) continue;;
for (auto& task :tasks) {
task->SetProgress(0, false);
task->SetUnique();
}
}
}

View File

@ -170,6 +170,11 @@ public:
*/ */
bool HasMission(uint32_t missionId); bool HasMission(uint32_t missionId);
/**
* Clears property visitng missions if they have not been completed
*/
void FixPropertyVistingMissions();
private: private:
/** /**
* All the missions owned by this entity, mapped by mission ID * All the missions owned by this entity, mapped by mission ID

View File

@ -332,12 +332,12 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
case eMissionTaskType::VISIT_PROPERTY: case eMissionTaskType::VISIT_PROPERTY:
{ {
if (!InAllTargets(value)) break; if (!InAllTargets(value)) break;
uint64_t key = (static_cast<uint64_t>(value) << 31U) | associate;
if (std::find(unique.begin(), unique.end(), static_cast<uint32_t>(associate)) != unique.end()) break; if (std::find(unique.begin(), unique.end(), static_cast<uint32_t>(key)) != unique.end()) break;
AddProgress(count); AddProgress(count);
unique.push_back(associate); unique.push_back(key);
break; break;
} }

View File

@ -87,7 +87,7 @@ public:
* Sets the uniquely visited list of locations * Sets the uniquely visited list of locations
* @param value the uniquely visited list of locations * @param value the uniquely visited list of locations
*/ */
void SetUnique(const std::vector<uint32_t>& value); void SetUnique(const std::vector<uint32_t>& value = {});
/** /**
* Returns the possibly target values for this mission task for progression * Returns the possibly target values for this mission task for progression

View File

@ -59,6 +59,7 @@
#include "PropertyManagementComponent.h" #include "PropertyManagementComponent.h"
#include "AssetManager.h" #include "AssetManager.h"
#include "LevelProgressionComponent.h" #include "LevelProgressionComponent.h"
#include "MissionComponent.h"
#include "eBlueprintSaveResponseType.h" #include "eBlueprintSaveResponseType.h"
#include "Amf3.h" #include "Amf3.h"
#include "NiPoint3.h" #include "NiPoint3.h"
@ -1035,6 +1036,8 @@ void HandlePacket(Packet* packet) {
// Do charxml fixes here // Do charxml fixes here
auto* levelComponent = player->GetComponent<LevelProgressionComponent>(); auto* levelComponent = player->GetComponent<LevelProgressionComponent>();
if (!levelComponent) return; if (!levelComponent) return;
auto* missionComponent = player->GetComponent<MissionComponent>();
if (!missionComponent) return;
auto version = levelComponent->GetCharacterVersion(); auto version = levelComponent->GetCharacterVersion();
switch(version) { switch(version) {
@ -1051,6 +1054,10 @@ void HandlePacket(Packet* packet) {
case eCharacterVersion::VAULT_SIZE: case eCharacterVersion::VAULT_SIZE:
Game::logger->Log("WorldServer", "Updaing Speedbase"); Game::logger->Log("WorldServer", "Updaing Speedbase");
levelComponent->SetRetroactiveBaseSpeed(); levelComponent->SetRetroactiveBaseSpeed();
levelComponent->SetCharacterVersion(eCharacterVersion::SPEED_BASE);
case eCharacterVersion::SPEED_BASE:
Game::logger->Log("WorldServer", "Fixing Properties Visited");
missionComponent->FixPropertyVistingMissions();
levelComponent->SetCharacterVersion(eCharacterVersion::UP_TO_DATE); levelComponent->SetCharacterVersion(eCharacterVersion::UP_TO_DATE);
case eCharacterVersion::UP_TO_DATE: case eCharacterVersion::UP_TO_DATE:
break; break;