2021-12-05 17:54:36 +00:00
|
|
|
#include "NpcWispServer.h"
|
|
|
|
#include "InventoryComponent.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "Entity.h"
|
|
|
|
#include "GameMessages.h"
|
2023-01-07 05:17:05 +00:00
|
|
|
#include "eMissionState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
void NpcWispServer::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
|
|
|
|
if (missionID != 1849 && missionID != 1883)
|
|
|
|
return;
|
|
|
|
|
|
|
|
auto* inventory = target->GetComponent<InventoryComponent>();
|
|
|
|
if (inventory == nullptr)
|
|
|
|
return;
|
|
|
|
|
2022-01-14 13:00:09 +00:00
|
|
|
LOT maelstromVacuumLot = 14592;
|
|
|
|
auto* maelstromVacuum = inventory->FindItemByLot(maelstromVacuumLot);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-01-14 13:00:09 +00:00
|
|
|
// For the daily we add the maelstrom vacuum if the player doesn't have it yet
|
2021-12-05 17:54:36 +00:00
|
|
|
if (missionID == 1883 && (missionState == eMissionState::AVAILABLE || missionState == eMissionState::COMPLETE_AVAILABLE)
|
2022-01-14 13:00:09 +00:00
|
|
|
&& maelstromVacuum == nullptr) {
|
2023-05-02 22:39:21 +00:00
|
|
|
inventory->AddItem(maelstromVacuumLot, 1, eLootSourceType::NONE);
|
2021-12-05 17:54:36 +00:00
|
|
|
} else if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
2022-01-14 13:00:09 +00:00
|
|
|
inventory->RemoveItem(maelstromVacuumLot, 1);
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Next up hide or show the samples based on the mission state
|
|
|
|
auto visible = 1;
|
|
|
|
if (missionState == eMissionState::READY_TO_COMPLETE || missionState == eMissionState::COMPLETE_READY_TO_COMPLETE) {
|
|
|
|
visible = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
auto groups = missionID == 1849
|
|
|
|
? std::vector<std::string> { "MaelstromSamples" }
|
|
|
|
: std::vector<std::string>{ "MaelstromSamples", "MaelstromSamples2ndary1", "MaelstromSamples2ndary2" };
|
|
|
|
|
|
|
|
for (const auto& group : groups) {
|
|
|
|
auto samples = EntityManager::Instance()->GetEntitiesInGroup(group);
|
|
|
|
for (auto* sample : samples) {
|
|
|
|
GameMessages::SendNotifyClientObject(sample->GetObjectID(), u"SetVisibility", visible, 0,
|
|
|
|
target->GetObjectID(), "", target->GetSystemAddress());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|