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,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);
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user