Files
DarkflameServer/dScripts/ai/PROPERTY/AG/AgPropGuard.cpp
Aaron Kimbrell b5e9d3b94c fix: AG property guard camera and foot race starter group
Two script TODOs with the live scripts shipped in the client to follow:

- AgPropGuard: accepting mission 768 before touching the orb (flag 71
  unset) plays the "MissionCam" cinematic, as L_AG_PROP_GUARD.lua does.
  Also no longer dereferences a missing Character.
- BaseFootRaceManager: joins the "FootRaceStarter" group on startup like
  L_ACT_BASE_FOOT_RACE.lua, since other foot race objects look the
  starters up through that group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:46 -05:00

44 lines
1.8 KiB
C++

#include "AgPropGuard.h"
#include "GameMessages.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) {
auto* character = target->GetCharacter();
auto* missionComponent = target->GetComponent<MissionComponent>();
auto* inventoryComponent = target->GetComponent<InventoryComponent>();
const auto state = missionComponent->GetMissionState(320);
if (missionID == 768 && missionState == eMissionState::AVAILABLE) {
// Players who have not touched the orb yet get a camera pan showing where it is.
if (character && !character->GetPlayerFlag(71)) {
GameMessages::SendPlayCinematic(target->GetObjectID(), u"MissionCam", target->GetSystemAddress());
}
} else if (missionID == 768 && missionState >= eMissionState::READY_TO_COMPLETE) {
//remove the inventory items
for (int item : gearSets) {
auto* id = inventoryComponent->FindItemByLot(item);
if (id) {
inventoryComponent->UnEquipItem(id);
inventoryComponent->RemoveItem(id->GetLot(), id->GetCount(), eInventoryType::ALL);
}
}
} 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());
auto* const character = target->GetCharacter();
if (character) character->SetPlayerFlag(113, true);
Game::entityManager->GetZoneControlEntity()->AddTimer("GuardFlyAway", 1.0f);
}
}