DarkflameServer/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp

41 lines
1.5 KiB
C++
Raw Permalink Normal View History

2022-08-06 03:01:59 +00:00
#include "AgPropGuard.h"
#include "Entity.h"
#include "Character.h"
#include "EntityManager.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
#include "Item.h"
#include "eMissionState.h"
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
2022-07-28 13:39:57 +00:00
auto* character = target->GetCharacter();
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
2022-07-28 13:39:57 +00:00
const auto state = missionComponent->GetMissionState(320);
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
2022-07-28 13:39:57 +00:00
if (!character->GetPlayerFlag(71)) {
// TODO: Cinematic "MissionCam"
}
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
//remove the inventory items
2022-07-28 13:39:57 +00:00
for (int item : gearSets) {
auto* id = inventoryComponent->FindItemByLot(item);
2022-07-28 13:39:57 +00:00
if (id) {
inventoryComponent->UnEquipItem(id);
inventoryComponent->RemoveItem(id->GetLot(), id->GetCount());
}
}
2022-07-28 13:39:57 +00:00
} else if (
(missionID == 320 && state == eMissionState::AVAILABLE) /*||
(state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/
2022-07-28 13:39:57 +00:00
) {
//GameMessages::SendNotifyClientObject(EntityManager::Instance()->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
2022-07-28 13:39:57 +00:00
target->GetCharacter()->SetPlayerFlag(113, true);
2022-07-28 13:39:57 +00:00
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
}
}