DarkflameServer/dScripts/AgPropGuard.cpp

40 lines
1.6 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"
2022-07-28 13:39:57 +00:00
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, MissionState missionState) {
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 == MissionState::MISSION_STATE_AVAILABLE) {
if (!character->GetPlayerFlag(71)) {
// TODO: Cinematic "MissionCam"
}
} else if (missionID == 768 && missionState >= MissionState::MISSION_STATE_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 == MissionState::MISSION_STATE_AVAILABLE) /*||
(state == MissionState::MISSION_STATE_COMPLETE && missionID == 891 && missionState == MissionState::MISSION_STATE_READY_TO_COMPLETE)*/
) {
//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);
}
}