From 1607b506c86f9996225c89a4a486087c30860891 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:42:03 -0800 Subject: [PATCH 1/6] bodgy bodge to fix minigame missions --- dGame/dMission/Mission.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index a054c605..7523dffe 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -109,7 +109,7 @@ void Mission::LoadFromXml(tinyxml2::XMLElement* element) { } else { const auto value = std::stoul(task->Attribute("v")); - m_Tasks[index]->SetProgress(value, false); + m_Tasks[index]->SetProgress(value, m_Tasks[index]->GetType() == MissionTaskType::MISSION_TASK_TYPE_MINIGAME); task = task->NextSiblingElement(); } @@ -356,7 +356,7 @@ void Mission::CheckCompletion() { return; } - SetMissionState(MissionState::MISSION_STATE_READY_TO_COMPLETE); + MakeReadyToComplete(); } void Mission::Catchup() { From b077bd937d960fb96afa894cd7fb377f8d27bfd7 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:42:17 -0800 Subject: [PATCH 2/6] Fixed bugs with minigame progression --- dGame/dMission/MissionTask.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 4c49327d..8503e8bc 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); } @@ -354,7 +345,7 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& } if(info->targetGroup == targets && value >= info->targetValue) { - SetProgress(info->target); + SetProgress(info->targetValue); break; } break; From a60738f78ff02741b4797e2e5507a852bf4aa646 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 9 Feb 2022 16:42:31 -0800 Subject: [PATCH 3/6] cleaned up SGCannon --- dScripts/SGCannon.cpp | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) 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()); From 2bc9f8f66d5293dde77388f52512d83be4f8aa25 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 10 Feb 2022 03:08:47 -0800 Subject: [PATCH 4/6] Correctly set task value for shooting gallery --- dGame/dMission/Mission.cpp | 2 +- dGame/dMission/MissionTask.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/dGame/dMission/Mission.cpp b/dGame/dMission/Mission.cpp index 7523dffe..2719a6cf 100644 --- a/dGame/dMission/Mission.cpp +++ b/dGame/dMission/Mission.cpp @@ -109,7 +109,7 @@ void Mission::LoadFromXml(tinyxml2::XMLElement* element) { } else { const auto value = std::stoul(task->Attribute("v")); - m_Tasks[index]->SetProgress(value, m_Tasks[index]->GetType() == MissionTaskType::MISSION_TASK_TYPE_MINIGAME); + m_Tasks[index]->SetProgress(value, false); task = task->NextSiblingElement(); } diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index 8503e8bc..cb0371e5 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -343,7 +343,14 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& if (info->target != gameID) { break; } - + // Lego Universe is a great game with very easy to understand mission progression. + // If we are progressing a mission for shooting gallery we need to set its + // completion to 1 and not the targetValue beacuse that makes sense + // compared to all other missions and tasks :) + 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->targetValue); break; From 3d1283675f68848fa7e8c0f537df959b11ab0410 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 20 Feb 2022 20:00:56 -0800 Subject: [PATCH 5/6] Updated comment --- dGame/dMission/MissionTask.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index cb0371e5..c732925c 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -343,10 +343,8 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string& if (info->target != gameID) { break; } - // Lego Universe is a great game with very easy to understand mission progression. - // If we are progressing a mission for shooting gallery we need to set its - // completion to 1 and not the targetValue beacuse that makes sense - // compared to all other missions and tasks :) + // 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; From 24d443537ab7539c704bcb31322baf4fd55a44b0 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sun, 20 Feb 2022 20:01:55 -0800 Subject: [PATCH 6/6] Addressed spacing --- dGame/dMission/MissionTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dGame/dMission/MissionTask.cpp b/dGame/dMission/MissionTask.cpp index c732925c..2ef36fd0 100644 --- a/dGame/dMission/MissionTask.cpp +++ b/dGame/dMission/MissionTask.cpp @@ -78,7 +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); }