DarkflameServer/dScripts/02_server/Map/njhub/NjColeNPC.cpp
Aaron Kimbrell 6aa90ad5b2
Breakout rest of the enums from dCommonVars and clean it up (#1061)
* Breakout rest of the enums from dcommonvars
so we don't have to deal with merge conflicts
ePlayerFlags is not a scoped enum, yet, due to it's complexity

* address feedback

* make player flag types consistent

* fix typo
2023-05-02 17:39:21 -05:00

50 lines
1.3 KiB
C++

#include "NjColeNPC.h"
#include "MissionComponent.h"
#include "InventoryComponent.h"
#include "eMissionState.h"
void NjColeNPC::OnEmoteReceived(Entity* self, int32_t emote, Entity* target) {
if (emote != 393) {
return;
}
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
if (inventoryComponent == nullptr) {
return;
}
if (!inventoryComponent->IsEquipped(14499) && !inventoryComponent->IsEquipped(16644)) {
return;
}
auto* missionComponent = target->GetComponent<MissionComponent>();
if (missionComponent == nullptr) {
return;
}
missionComponent->ForceProgressTaskType(1818, 1, 1);
}
void NjColeNPC::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
NjNPCMissionSpinjitzuServer::OnMissionDialogueOK(self, target, missionID, missionState);
if (missionID == 1818 && missionState >= eMissionState::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::NONE);
}
}