2021-12-05 17:54:36 +00:00
|
|
|
#include "NtDukeServer.h"
|
|
|
|
#include "InventoryComponent.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "MissionComponent.h"
|
|
|
|
#include "eMissionState.h"
|
2023-05-02 22:39:21 +00:00
|
|
|
#include "ePlayerFlag.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void NtDukeServer::SetVariables(Entity* self) {
|
|
|
|
self->SetVar<float_t>(m_SpyProximityVariable, 35.0f);
|
|
|
|
|
|
|
|
self->SetVar<SpyData>(m_SpyDataVariable, {
|
2023-05-02 22:39:21 +00:00
|
|
|
ePlayerFlag::NT_FACTION_SPY_DUKE, 13548, 1319
|
2021-12-05 17:54:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
self->SetVar<std::vector<SpyDialogue>>(m_SpyDialogueTableVariable, {
|
|
|
|
{ "DUKE_NT_CONVO_1", 0 },
|
|
|
|
{ "DUKE_NT_CONVO_2", 0 },
|
|
|
|
{ "DUKE_NT_CONVO_3", 0 },
|
|
|
|
});
|
|
|
|
|
|
|
|
// If there's an alternating conversation, indices should be provided using the conversationID variables
|
|
|
|
self->SetVar<std::vector<LWOOBJID>>(m_SpyCinematicObjectsVariable, { self->GetObjectID() });
|
|
|
|
}
|
|
|
|
|
|
|
|
void NtDukeServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
|
|
|
|
|
|
|
// Handles adding and removing the sword for the Crux Prime Sword mission
|
2023-06-09 08:27:05 +00:00
|
|
|
auto* missionComponent = target->GetComponent<MissionComponent>();
|
|
|
|
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
if (missionComponent != nullptr && inventoryComponent != nullptr) {
|
|
|
|
auto state = missionComponent->GetMissionState(m_SwordMissionID);
|
|
|
|
auto lotCount = inventoryComponent->GetLotCount(m_SwordLot);
|
|
|
|
|
|
|
|
if ((state == eMissionState::AVAILABLE || state == eMissionState::ACTIVE) && lotCount < 1) {
|
2023-05-02 22:39:21 +00:00
|
|
|
inventoryComponent->AddItem(m_SwordLot, 1, eLootSourceType::NONE);
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (state == eMissionState::READY_TO_COMPLETE) {
|
|
|
|
inventoryComponent->RemoveItem(m_SwordLot, lotCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|