2023-10-22 15:36:08 +00:00
|
|
|
#include "DukeDialogueGlowingBrick.h"
|
|
|
|
|
|
|
|
#include "eMissionState.h"
|
|
|
|
|
|
|
|
#include "Recorder.h"
|
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "InventoryComponent.h"
|
|
|
|
|
|
|
|
void DukeDialogueGlowingBrick::OnStartup(Entity* self) {
|
|
|
|
Game::logger->Log("DukeDialogueGlowingBrick", "OnStartup");
|
|
|
|
}
|
|
|
|
|
|
|
|
void DukeDialogueGlowingBrick::OnTimerDone(Entity* self, std::string timerName) {
|
|
|
|
}
|
|
|
|
|
|
|
|
void DukeDialogueGlowingBrick::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
|
|
|
if (missionID != 201453) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (missionState != eMissionState::AVAILABLE) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2023-10-27 21:51:38 +00:00
|
|
|
auto* recorder = Cinema::Recording::Recorder::LoadFromFile("DukeGlowing.xml");
|
2023-10-22 15:36:08 +00:00
|
|
|
|
|
|
|
if (recorder == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* actor = recorder->ActFor(self, target);
|
|
|
|
|
|
|
|
if (actor == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const auto targetID = target->GetObjectID();
|
|
|
|
const auto actorID = actor->GetObjectID();
|
|
|
|
|
|
|
|
self->AddCallbackTimer(3.0f, [targetID] () {
|
|
|
|
auto* target = Game::entityManager->GetEntity(targetID);
|
|
|
|
|
|
|
|
if (target == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
|
|
|
|
|
|
|
if (missionComponent == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
missionComponent->CompleteMission(201453);
|
|
|
|
});
|
|
|
|
|
|
|
|
self->AddCallbackTimer(recorder->GetDuration() + 10.0f, [recorder, self, actorID, targetID] () {
|
|
|
|
auto* target = Game::entityManager->GetEntity(targetID);
|
|
|
|
auto* actor = Game::entityManager->GetEntity(actorID);
|
|
|
|
|
|
|
|
if (target == nullptr || actor == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
recorder->StopActingFor(actor, self, targetID);
|
|
|
|
|
|
|
|
delete recorder;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
void DukeDialogueGlowingBrick::OnRespondToMission(Entity* self, int missionID, Entity* player, int reward) {
|
|
|
|
|
|
|
|
}
|