mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-08 17:28:20 +00:00
455f9470a5
* Move EntityManager to Game namespace * move initialization to later Need to wait for dZoneManager to be initialized. * Fix bugs - Cannot delete from a RandomAccessIterator while in a range based for loop. Touchup zone manager initialize replace magic numbers with better named constants replace magic zonecontrol id with a more readable hex alternative condense stack variables move initializers closer to their use initialize entity manager with zone control change initialize timings If zone is not zero we expect to initialize the entity manager during zone manager initialization Add constexpr for zone control LOT * Add proper error handling * revert vanity changes * Update WorldServer.cpp * Update dZoneManager.cpp
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include "Darkitect.h"
|
|
#include "MissionComponent.h"
|
|
#include "DestroyableComponent.h"
|
|
#include "EntityManager.h"
|
|
#include "GameMessages.h"
|
|
#include "Character.h"
|
|
#include "eMissionState.h"
|
|
|
|
void Darkitect::Reveal(Entity* self, Entity* player) {
|
|
const auto playerID = player->GetObjectID();
|
|
|
|
GameMessages::SendNotifyClientObject(self->GetObjectID(), u"reveal", 0, 0, playerID, "", player->GetSystemAddress());
|
|
|
|
self->AddCallbackTimer(20, [this, self, playerID]() {
|
|
auto* player = Game::entityManager->GetEntity(playerID);
|
|
|
|
if (!player) return;
|
|
|
|
auto* destroyableComponent = player->GetComponent<DestroyableComponent>();
|
|
auto* missionComponent = player->GetComponent<MissionComponent>();
|
|
auto* character = player->GetCharacter();
|
|
|
|
if (destroyableComponent != nullptr && missionComponent != nullptr && character != nullptr) {
|
|
destroyableComponent->SetArmor(0);
|
|
destroyableComponent->SetHealth(1);
|
|
destroyableComponent->SetImagination(0);
|
|
|
|
if (missionComponent->GetMissionState(1295) == eMissionState::ACTIVE) {
|
|
character->SetPlayerFlag(1911, true);
|
|
}
|
|
|
|
Game::entityManager->SerializeEntity(player);
|
|
}
|
|
});
|
|
}
|