cleaned up SGCannon

This commit is contained in:
EmosewaMC 2022-02-09 16:42:31 -08:00
parent b077bd937d
commit a60738f78f

View File

@ -61,8 +61,6 @@ void SGCannon::OnStartup(Entity *self) {
void SGCannon::OnPlayerLoaded(Entity *self, Entity *player) { void SGCannon::OnPlayerLoaded(Entity *self, Entity *player) {
Game::logger->Log("SGCannon", "Player loaded\n"); Game::logger->Log("SGCannon", "Player loaded\n");
self->SetVar<LWOOBJID>(PlayerIDVariable, player->GetObjectID()); 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, 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>(); 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) { if (missionComponent != nullptr) {
missionComponent->Progress( missionComponent->Progress(MissionTaskType::MISSION_TASK_TYPE_MINIGAME, self->GetVar<uint32_t>(TotalScoreVariable), self->GetObjectID(), "performact_score");
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_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)); 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));
StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), StopActivity(self, player->GetObjectID(), self->GetVar<uint32_t>(TotalScoreVariable), self->GetVar<uint32_t>(MaxStreakVariable), percentage);
self->GetVar<uint32_t>(MaxStreakVariable), percentage);
self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true); self->SetNetworkVar<bool>(AudioFinalWaveDoneVariable, true);
// Give the player the model rewards they earned // 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", self->SetNetworkVar<std::u16string>(u"UI_Rewards",
GeneralUtils::to_u16string(self->GetVar<uint32_t>(TotalScoreVariable)) + u"_0_0_0_0_0_0" GeneralUtils::to_u16string(self->GetVar<uint32_t>(TotalScoreVariable)) + u"_0_0_0_0_0_0"
); );
self->SetVar<uint32_t>(TotalScoreVariable, 0);
GameMessages::SendRequestActivitySummaryLeaderboardData( GameMessages::SendRequestActivitySummaryLeaderboardData(
player->GetObjectID(), player->GetObjectID(),
@ -612,9 +592,6 @@ void SGCannon::StopGame(Entity *self, bool cancel) {
0, 0,
false 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()); GameMessages::SendActivityStop(self->GetObjectID(), false, cancel, player->GetSystemAddress());