2022-07-05 06:00:10 +00:00
|
|
|
#include "FvRaceSmashEggImagineServer.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "CharacterComponent.h"
|
2022-02-05 11:28:17 +00:00
|
|
|
#include "DestroyableComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "PossessableComponent.h"
|
2023-01-22 23:38:47 +00:00
|
|
|
#include "eRacingTaskParam.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "MissionComponent.h"
|
2023-01-22 23:38:47 +00:00
|
|
|
#include "eMissionTaskType.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
void FvRaceSmashEggImagineServer::OnDie(Entity* self, Entity* killer) {
|
|
|
|
if (killer != nullptr) {
|
|
|
|
auto* destroyableComponent = killer->GetComponent<DestroyableComponent>();
|
|
|
|
if (destroyableComponent != nullptr) {
|
|
|
|
destroyableComponent->SetImagination(destroyableComponent->GetImagination() + 10);
|
2023-07-15 20:56:33 +00:00
|
|
|
Game::entityManager->SerializeEntity(killer);
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
// get possessor to progress statistics and tasks.
|
|
|
|
auto* possessableComponent = killer->GetComponent<PossessableComponent>();
|
|
|
|
if (possessableComponent != nullptr) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-07-15 20:56:33 +00:00
|
|
|
auto* possessor = Game::entityManager->GetEntity(possessableComponent->GetPossessor());
|
2022-07-28 13:39:57 +00:00
|
|
|
if (possessor != nullptr) {
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
auto* missionComponent = possessor->GetComponent<MissionComponent>();
|
|
|
|
auto* characterComponent = possessor->GetComponent<CharacterComponent>();
|
|
|
|
if (characterComponent != nullptr) {
|
|
|
|
characterComponent->UpdatePlayerStatistic(ImaginationPowerUpsCollected);
|
|
|
|
characterComponent->UpdatePlayerStatistic(RacingSmashablesSmashed);
|
|
|
|
}
|
|
|
|
if (missionComponent == nullptr) return;
|
|
|
|
// Dragon eggs have their own smash server so we handle mission progression for them here.
|
2023-12-28 04:18:20 +00:00
|
|
|
missionComponent->Progress(eMissionTaskType::RACING, 0, static_cast<LWOOBJID>(eRacingTaskParam::SMASHABLES));
|
|
|
|
missionComponent->Progress(eMissionTaskType::RACING, self->GetLOT(), static_cast<LWOOBJID>(eRacingTaskParam::SMASH_SPECIFIC_SMASHABLE));
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|