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,9 +1,8 @@
#include "AgCagedBricksServer.h"
#include "InventoryComponent.h"
#include "GameMessages.h"
#include "Character.h"
#include "EntityManager.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
@@ -14,14 +13,14 @@ void AgCagedBricksServer::OnUse(Entity* self, Entity* user) {
}
//Set the flag & mission status:
auto character = user->GetCharacter();
if (!character) return;
character->SetPlayerFlag(ePlayerFlag::CAGED_SPIDER, true);
GameMessages::SetFlag setFlag{};
setFlag.target = user->GetObjectID();
setFlag.iFlagId = ePlayerFlag::CAGED_SPIDER;
setFlag.bFlag = true;
SEND_ENTITY_MSG(setFlag);
//Remove the maelstrom cube:
auto inv = static_cast<InventoryComponent*>(user->GetComponent(eReplicaComponentType::INVENTORY));
auto* inv = user->GetComponent<InventoryComponent>();
if (inv) {
inv->RemoveItem(14553, 1);

View File

@@ -1,9 +1,8 @@
#include "RemoveRentalGear.h"
#include "InventoryComponent.h"
#include "Item.h"
#include "eMissionState.h"
#include "Character.h"
#include "eReplicaComponentType.h"
#include "ePlayerFlag.h"
/*
@@ -23,7 +22,7 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis
if (missionID != defaultMission && missionID != 313) return;
if (missionState == eMissionState::COMPLETE || missionState == eMissionState::READY_TO_COMPLETE) {
auto inv = static_cast<InventoryComponent*>(target->GetComponent(eReplicaComponentType::INVENTORY));
auto* inv = target->GetComponent<InventoryComponent>();
if (!inv) return;
//remove the inventory items
@@ -36,7 +35,10 @@ void RemoveRentalGear::OnMissionDialogueOK(Entity* self, Entity* target, int mis
}
//reset the equipment flag
auto character = target->GetCharacter();
if (character) character->SetPlayerFlag(ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR, false);
GameMessages::SetFlag setFlag{};
setFlag.target = target->GetObjectID();
setFlag.iFlagId = ePlayerFlag::EQUPPED_TRIAL_FACTION_GEAR;
setFlag.bFlag = false;
SEND_ENTITY_MSG(setFlag);
}
}