Add FlagComponent and msg handlers

This commit is contained in:
David Markowitz
2025-01-20 02:53:21 -08:00
parent e4c2eecbc7
commit af2ba5b287
53 changed files with 781 additions and 486 deletions

View File

@@ -1,6 +1,6 @@
#include "AgPropGuard.h"
#include "Entity.h"
#include "Character.h"
#include "EntityManager.h"
#include "InventoryComponent.h"
#include "MissionComponent.h"
@@ -8,13 +8,16 @@
#include "eMissionState.h"
void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* character = target->GetCharacter();
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
if (!missionComponent || !inventoryComponent) return;
const auto state = missionComponent->GetMissionState(320);
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
if (!character->GetPlayerFlag(71)) {
GameMessages::GetFlag getFlag{};
getFlag.target = target->GetObjectID();
getFlag.iFlagId = 71;
if (SEND_ENTITY_MSG(getFlag) && !getFlag.bFlag) {
// TODO: Cinematic "MissionCam"
}
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
@@ -27,13 +30,12 @@ void AgPropGuard::OnMissionDialogueOK(Entity* self, Entity* target, int missionI
inventoryComponent->RemoveItem(id->GetLot(), id->GetCount());
}
}
} else if (
(missionID == 320 && state == eMissionState::AVAILABLE) /*||
(state == eMissionState::COMPLETE && missionID == 891 && missionState == eMissionState::READY_TO_COMPLETE)*/
) {
//GameMessages::SendNotifyClientObject(Game::entityManager->GetZoneControlEntity()->GetObjectID(), u"GuardChat", target->GetObjectID(), 0, target->GetObjectID(), "", target->GetSystemAddress());
target->GetCharacter()->SetPlayerFlag(113, true);
} else if (missionID == 320 && state == eMissionState::AVAILABLE) {
GameMessages::SetFlag setFlag{};
setFlag.target = target->GetObjectID();
setFlag.iFlagId = 113;
setFlag.bFlag = true;
SEND_ENTITY_MSG(setFlag);
Game::entityManager->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
}

View File

@@ -1,21 +1,21 @@
#include "AgPropguards.h"
#include "Character.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "dZoneManager.h"
#include "eMissionState.h"
void AgPropguards::OnMissionDialogueOK(Entity* self, Entity* target, int missionID, eMissionState missionState) {
auto* character = target->GetCharacter();
if (character == nullptr)
return;
const auto flag = GetFlagForMission(missionID);
if (flag == 0)
return;
GameMessages::GetFlag getFlag{};
getFlag.target = target->GetObjectID();
getFlag.iFlagId = flag;
if ((missionState == eMissionState::AVAILABLE || missionState == eMissionState::ACTIVE)
&& !character->GetPlayerFlag(flag)) {
&& SEND_ENTITY_MSG(getFlag) && !getFlag.bFlag) {
// If the player just started the mission, play a cinematic highlighting the target
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
} else if (missionState == eMissionState::READY_TO_COMPLETE) {