2021-12-05 17:54:36 +00:00
|
|
|
#include "NpcCowboyServer.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "eMissionState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "InventoryComponent.h"
|
2024-02-11 06:38:21 +00:00
|
|
|
#include "dZoneManager.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void NpcCowboyServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
|
|
|
if (missionID != 1880) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
|
|
|
|
|
|
|
|
if (inventoryComponent == nullptr) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (missionState == eMissionState::COMPLETE_ACTIVE ||
|
|
|
|
missionState == eMissionState::ACTIVE ||
|
|
|
|
missionState == eMissionState::AVAILABLE ||
|
|
|
|
missionState == eMissionState::COMPLETE_AVAILABLE) {
|
|
|
|
if (inventoryComponent->GetLotCount(14378) == 0) {
|
2023-05-02 22:39:21 +00:00
|
|
|
inventoryComponent->AddItem(14378, 1, eLootSourceType::NONE);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
2022-02-07 20:45:56 +00:00
|
|
|
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
2021-12-05 17:54:36 +00:00
|
|
|
inventoryComponent->RemoveItem(14378, 1);
|
|
|
|
}
|
2024-02-11 06:38:21 +00:00
|
|
|
|
|
|
|
// Next up hide or show the samples based on the mission state
|
|
|
|
int32_t visible = 1;
|
|
|
|
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
|
|
|
visible = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto spawners = Game::zoneManager->GetSpawnersByName("PlungerGunTargets");
|
|
|
|
for (auto* spawner : spawners) {
|
|
|
|
for (const auto entity : spawner->GetSpawnedObjectIDs())
|
|
|
|
GameMessages::SendNotifyClientObject(entity, u"SetVisibility", visible, 0,
|
|
|
|
target->GetObjectID(), "", target->GetSystemAddress());
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|