From 933cdee414e6abad4df40186c4ce43748e64f55e Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 5 Feb 2022 04:08:40 -0800 Subject: [PATCH] Implemented Model Pickup and Reputation achievements (#413) * Implemented Model Pickup and Reputation achievements * Moved mission progression to placement * Changed name to place --- dGame/dComponents/PropertyManagementComponent.cpp | 3 +++ dGame/dMission/Mission.cpp | 3 ++- dGame/dMission/MissionTask.cpp | 7 ++++++- dGame/dMission/MissionTaskType.h | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index bf89eb22..506c1608 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -388,6 +388,9 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N EntityManager::Instance()->GetZoneControlEntity()->OnZonePropertyModelPlaced(entity); }); + // Progress place model missions + auto missionComponent = entity->GetComponent(); + if (missionComponent != nullptr) missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_PLACE_MODEL, 0); } void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int deleteReason) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 854782f9..a054c605 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -516,7 +516,8 @@ void Mission::YieldRewards() { } if (info->reward_reputation > 0) { - // TODO: In case of reputation, write code + // TODO: Track reputation in the character and database. + missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION, 0, 0L, "", info->reward_reputation); } if (info->reward_maxhealth > 0) { diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 12272008..4c49327d 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -460,6 +460,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& case MissionTaskType::MISSION_TASK_TYPE_SMASH: case MissionTaskType::MISSION_TASK_TYPE_ITEM_COLLECTION: case MissionTaskType::MISSION_TASK_TYPE_PLAYER_FLAG: + case MissionTaskType::MISSION_TASK_TYPE_EARN_REPUTATION: { if (!InAllTargets(value)) break; @@ -467,7 +468,11 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& break; } - + case MissionTaskType::MISSION_TASK_TYPE_PLACE_MODEL: + { + AddProgress(count); + break; + } default: Game::logger->Log("MissionTask", "Invalid mission task type (%i)!\n", static_cast(type)); return; diff --git a/dGame/dMission/MissionTaskType.h b/dGame/dMission/MissionTaskType.h index 6643d161..263bf470 100644 --- a/dGame/dMission/MissionTaskType.h +++ b/dGame/dMission/MissionTaskType.h @@ -16,9 +16,11 @@ enum class MissionTaskType : int { MISSION_TASK_TYPE_MINIGAME = 14, //!< A task for doing something in a minigame MISSION_TASK_TYPE_NON_MISSION_INTERACTION = 15, //!< A task for interacting with a non-mission MISSION_TASK_TYPE_MISSION_COMPLETE = 16, //!< A task for completing a mission + MISSION_TASK_TYPE_EARN_REPUTATION = 17, //!< A task for earning reputation MISSION_TASK_TYPE_POWERUP = 21, //!< A task for collecting a powerup MISSION_TASK_TYPE_PET_TAMING = 22, //!< A task for taming a pet MISSION_TASK_TYPE_RACING = 23, //!< A task for racing MISSION_TASK_TYPE_PLAYER_FLAG = 24, //!< A task for setting a player flag + MISSION_TASK_TYPE_PLACE_MODEL = 25, //!< A task for picking up a model MISSION_TASK_TYPE_VISIT_PROPERTY = 30 //!< A task for visiting a property };