diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index a054c605..2719a6cf 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -356,7 +356,7 @@ void Mission::CheckCompletion() { return; } - SetMissionState(MissionState::MISSION_STATE_READY_TO_COMPLETE); + MakeReadyToComplete(); } void Mission::Catchup() { diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 4c49327d..2ef36fd0 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -78,14 +78,7 @@ void MissionTask::SetProgress(const uint32_t value, const bool echo) std::vector updates; updates.push_back(static_cast(progress)); - - GameMessages::SendNotifyMissionTask( - entity, - entity->GetSystemAddress(), - static_cast(info->id), - static_cast(1 << (mask + 1)), - updates - ); + GameMessages::SendNotifyMissionTask(entity, entity->GetSystemAddress(), static_cast(info->id), static_cast(1 << (mask + 1)), updates); } @@ -190,15 +183,13 @@ bool MissionTask::InParameters(const uint32_t value) const bool MissionTask::IsComplete() const { - // Minigames are the only ones where the target value is a score they need to get but the actual target is the act ID - return GetType() == MissionTaskType::MISSION_TASK_TYPE_MINIGAME ? progress == info->target : progress >= info->targetValue; + return progress >= info->targetValue; } void MissionTask::Complete() { - // Minigames are the only ones where the target value is a score they need to get but the actual target is the act ID - SetProgress(GetType() == MissionTaskType::MISSION_TASK_TYPE_MINIGAME ? info->target : info->targetValue); + SetProgress(info->targetValue); } @@ -352,9 +343,14 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& if (info->target != gameID) { break; } - + // This special case is for shooting gallery missions that want their + // progress value set to 1 instead of being set to the target value. + if(info->targetGroup == targets && value >= info->targetValue && GetMission()->IsMission() && info->target == 1864 && info->targetGroup == "performact_score") { + SetProgress(1); + break; + } if(info->targetGroup == targets && value >= info->targetValue) { - SetProgress(info->target); + SetProgress(info->targetValue); break; } break; diff --git a/dScripts/SGCannon.cpp b/dScripts/SGCannon.cpp index 58e1d144..4b991253 100644 --- a/dScripts/SGCannon.cpp +++ b/dScripts/SGCannon.cpp @@ -61,8 +61,6 @@ void SGCannon::OnStartup(Entity *self) { void SGCannon::OnPlayerLoaded(Entity *self, Entity *player) { Game::logger->Log("SGCannon", "Player loaded\n"); self->SetVar(PlayerIDVariable, player->GetObjectID()); - /*GameMessages::SendSetStunned(player->GetObjectID(), PUSH, player->GetSystemAddress(), LWOOBJID_EMPTY, - true, true, true, true, true, true, true);*/ } void SGCannon::OnFireEventServerSide(Entity *self, Entity *sender, std::string args, int32_t param1, int32_t param2, @@ -561,32 +559,15 @@ void SGCannon::StopGame(Entity *self, bool cancel) { auto* missionComponent = player->GetComponent(); - if (self->GetVar(TotalScoreVariable) >= 25000) - { - // For some reason the client thinks this mission is not complete? - auto* mission = missionComponent->GetMission(229); - - if (mission != nullptr && !mission->IsComplete()) - { - mission->Complete(); - } - } - if (missionComponent != nullptr) { - missionComponent->Progress( - MissionTaskType::MISSION_TASK_TYPE_MINIGAME, - self->GetVar(TotalScoreVariable), - self->GetObjectID(), - "performact_score" - ); + missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar(TotalScoreVariable), self->GetObjectID(), "performact_score"); missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar(MaxStreakVariable), self->GetObjectID(), "performact_streak"); missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_CannonLot, 0, "", self->GetVar(TotalScoreVariable)); } LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar(TotalScoreVariable)); - StopActivity(self, player->GetObjectID(), self->GetVar(TotalScoreVariable), - self->GetVar(MaxStreakVariable), percentage); + StopActivity(self, player->GetObjectID(), self->GetVar(TotalScoreVariable), self->GetVar(MaxStreakVariable), percentage); self->SetNetworkVar(AudioFinalWaveDoneVariable, true); // Give the player the model rewards they earned @@ -600,7 +581,6 @@ void SGCannon::StopGame(Entity *self, bool cancel) { self->SetNetworkVar(u"UI_Rewards", GeneralUtils::to_u16string(self->GetVar(TotalScoreVariable)) + u"_0_0_0_0_0_0" ); - self->SetVar(TotalScoreVariable, 0); GameMessages::SendRequestActivitySummaryLeaderboardData( player->GetObjectID(), @@ -612,9 +592,6 @@ void SGCannon::StopGame(Entity *self, bool cancel) { 0, false ); - - // The end menu is not in, just send them back to the main world - //static_cast(player)->SendToZone(1300); } GameMessages::SendActivityStop(self->GetObjectID(), false, cancel, player->GetSystemAddress());