mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
Add FlagComponent and msg handlers
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user