Merge pull request #451 from EmosewaMC/ShootingGalleryScoreFix

Shooting Gallery daily mission fix
This commit is contained in:
Jett 2022-03-25 15:59:39 +00:00 committed by GitHub
commit 3a959778fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 40 deletions

View File

@ -356,7 +356,7 @@ void Mission::CheckCompletion() {
return;
}
SetMissionState(MissionState::MISSION_STATE_READY_TO_COMPLETE);
MakeReadyToComplete();
}
void Mission::Catchup() {

View File

@ -78,14 +78,7 @@ void MissionTask::SetProgress(const uint32_t value, const bool echo)
std::vector<float> updates;
updates.push_back(static_cast<float>(progress));
GameMessages::SendNotifyMissionTask(
entity,
entity->GetSystemAddress(),
static_cast<int>(info->id),
static_cast<int>(1 << (mask + 1)),
updates
);
GameMessages::SendNotifyMissionTask(entity, entity->GetSystemAddress(), static_cast<int>(info->id), static_cast<int>(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;

View File

@ -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<LWOOBJID>(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<MissionComponent>();
if (self->GetVar<uint32_t>(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<uint32_t>(TotalScoreVariable),
self->GetObjectID(),
"performact_score"
);
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(MaxStreakVariable), self->GetObjectID(), "performact_streak");
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_ACTIVITY, m_CannonLot, 0, "", self->GetVar<uint32_t>(TotalScoreVariable));
}
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable),
self->GetVar<uint32_t>(MaxStreakVariable), percentage);
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
// Give the player the model rewards they earned
@ -600,7 +581,6 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
self->SetNetworkVar<std::u16string>(u"UI_Rewards",
GeneralUtils::to_u16string(self->GetVar<uint32_t>(TotalScoreVariable)) + u"_0_0_0_0_0_0"
);
self->SetVar<uint32_t>(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*>(player)->SendToZone(1300);
}
GameMessages::SendActivityStop(self->GetObjectID(), false, cancel, player->GetSystemAddress());