2022-08-06 03:01:59 +00:00
|
|
|
#include "AgPropGuard.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "Entity.h"
|
|
|
|
#include "Character.h"
|
|
|
|
#include "EntityManager.h"
|
|
|
|
#include "InventoryComponent.h"
|
2022-07-05 06:00:10 +00:00
|
|
|
#include "MissionComponent.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "Item.h"
|
2023-01-22 23:38:47 +00:00
|
|
|
#include "eMissionState.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2023-01-22 23:38:47 +00:00
|
|
|
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>();
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
const auto state = missionComponent->GetMissionState(320);
|
2023-01-22 23:38:47 +00:00
|
|
|
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
|
2022-07-28 13:39:57 +00:00
|
|
|
if (!character->GetPlayerFlag(71)) {
|
|
|
|
// TODO: Cinematic "MissionCam"
|
|
|
|
}
|
2023-01-22 23:38:47 +00:00
|
|
|
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
|
2021-12-05 17:54:36 +00:00
|
|
|
//remove the inventory items
|
2022-07-28 13:39:57 +00:00
|
|
|
for (int item : gearSets) {
|
2021-12-05 17:54:36 +00:00
|
|
|
auto* id = inventoryComponent->FindItemByLot(item);
|
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
if (id) {
|
2021-12-05 17:54:36 +00:00
|
|
|
inventoryComponent->UnEquipItem(id);
|
|
|
|
inventoryComponent->RemoveItem(id->GetLot(), id->GetCount());
|
|
|
|
}
|
|
|
|
}
|
2022-07-28 13:39:57 +00:00
|
|
|
} else if (
|
2023-01-22 23:38:47 +00:00
|
|
|
(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());
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
target->GetCharacter()->SetPlayerFlag(113, true);
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2022-07-28 13:39:57 +00:00
|
|
|
EntityManager::Instance()->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
|
|
|
|
}
|
2021-12-05 17:54:36 +00:00
|
|
|
}
|