mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 23:17:28 +00:00
Fully Implemented Shooting Gallery Mission and Achievement Fixes (#381)
* Fixed tab indent * Fully implemented Achievement tracking for Shooting Gallery - Removed logging in MissionTask.cpp and moved the checks for mission progression to after checking the instance. - Implemented the achievement tracking in SGCannon as well as tracking of the maximum hit streak and progression of enemy smashes in the shooting gallery.
This commit is contained in:
parent
c6f220ee31
commit
fe178bf745
@ -338,9 +338,6 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
|||||||
|
|
||||||
case MissionTaskType::MISSION_TASK_TYPE_MINIGAME:
|
case MissionTaskType::MISSION_TASK_TYPE_MINIGAME:
|
||||||
{
|
{
|
||||||
if (targets != info->targetGroup || info->targetValue > value)
|
|
||||||
break;
|
|
||||||
|
|
||||||
auto* minigameManager = EntityManager::Instance()->GetEntity(associate);
|
auto* minigameManager = EntityManager::Instance()->GetEntity(associate);
|
||||||
if (minigameManager == nullptr)
|
if (minigameManager == nullptr)
|
||||||
break;
|
break;
|
||||||
@ -356,10 +353,10 @@ void MissionTask::Progress(int32_t value, LWOOBJID associate, const std::string&
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game::logger->Log("Minigame Task", "Progressing minigame with %s %d > %d (%d)\n",
|
if(info->targetGroup == targets && value >= info->targetValue) {
|
||||||
targets.c_str(), value, info->targetValue, gameID);
|
SetProgress(info->target);
|
||||||
SetProgress(info->target);
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,6 +579,8 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
|
|||||||
self->GetObjectID(),
|
self->GetObjectID(),
|
||||||
"performact_score"
|
"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));
|
LootGenerator::Instance().GiveActivityLoot(player, self, GetGameID(self), self->GetVar<uint32_t>(TotalScoreVariable));
|
||||||
@ -645,10 +647,6 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
|
|||||||
|
|
||||||
if (!self->GetVar<bool>(SuperChargeActiveVariable)) {
|
if (!self->GetVar<bool>(SuperChargeActiveVariable)) {
|
||||||
self->SetVar<uint32_t>(u"m_curStreak", self->GetVar<uint32_t>(u"m_curStreak") + 1);
|
self->SetVar<uint32_t>(u"m_curStreak", self->GetVar<uint32_t>(u"m_curStreak") + 1);
|
||||||
|
|
||||||
if (self->GetVar<uint32_t>(u"m_curStreak") > 12) {
|
|
||||||
self->SetVar<uint32_t>(u"m_curStreak", 12);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -693,6 +691,14 @@ void SGCannon::RegisterHit(Entity* self, Entity* target, const std::string& time
|
|||||||
self->SetNetworkVar<uint32_t>(u"updateScore", newScore);
|
self->SetNetworkVar<uint32_t>(u"updateScore", newScore);
|
||||||
|
|
||||||
self->SetNetworkVar<std::u16string>(u"beatHighScore", GeneralUtils::to_u16string(newScore));
|
self->SetNetworkVar<std::u16string>(u"beatHighScore", GeneralUtils::to_u16string(newScore));
|
||||||
|
|
||||||
|
auto* player = EntityManager::Instance()->GetEntity(self->GetVar<LWOOBJID>(PlayerIDVariable));
|
||||||
|
if (player == nullptr) return;
|
||||||
|
|
||||||
|
auto missionComponent = player->GetComponent<MissionComponent>();
|
||||||
|
if (missionComponent == nullptr) return;
|
||||||
|
|
||||||
|
missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_SMASH, spawnInfo.lot, self->GetObjectID());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SGCannon::UpdateStreak(Entity* self)
|
void SGCannon::UpdateStreak(Entity* self)
|
||||||
@ -722,6 +728,8 @@ void SGCannon::UpdateStreak(Entity* self)
|
|||||||
self->SetNetworkVar<bool>(u"UnMarkAll", true);
|
self->SetNetworkVar<bool>(u"UnMarkAll", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
auto maxStreak = self->GetVar<uint32_t>(MaxStreakVariable);
|
||||||
|
if (maxStreak < curStreak) self->SetVar<uint32_t>(MaxStreakVariable, curStreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
float_t SGCannon::GetCurrentBonus(Entity* self)
|
float_t SGCannon::GetCurrentBonus(Entity* self)
|
||||||
|
Loading…
Reference in New Issue
Block a user