DarkflameServer/dScripts/NjColeNPC.cpp

49 lines
1.3 KiB
C++
Raw Permalink Normal View History

#include "NjColeNPC.h"
#include "MissionComponent.h"
#include "InventoryComponent.h"
2022-07-28 13:39:57 +00:00
void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) {
if (emote != 393) {
return;
}
2022-07-28 13:39:57 +00:00
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
2022-07-28 13:39:57 +00:00
if (inventoryComponent == nullptr) {
return;
}
2022-07-28 13:39:57 +00:00
if (!inventoryComponent->IsEquipped(14499) && !inventoryComponent->IsEquipped(16644)) {
return;
}
2022-07-28 13:39:57 +00:00
auto* missionComponent = target->GetComponent<MissionComponent>();
2022-07-28 13:39:57 +00:00
if (missionComponent == nullptr) {
return;
}
2022-07-28 13:39:57 +00:00
missionComponent->ForceProgressTaskType(1818, 1, 1);
}
2022-07-28 13:39:57 +00:00
void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState);
if (missionID == 1818 && missionState >= MissionState::MISSION_STATE_READY_TO_COMPLETE) {
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
if (missionComponent == nullptr || inventoryComponent == nullptr) {
return;
}
if (inventoryComponent->GetLotCount(14499) > 0) {
inventoryComponent->RemoveItem(14499, 1);
} else {
return;
}
inventoryComponent->AddItem(16644, 1, eLootSourceType::LOOT_SOURCE_NONE);
}
}